【shell script example】
1.shell function: function FunName [()] {}
or
FunName {}
function load_video {
if [ x$feature_all_video_module = xy ];
then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
To determine whether the variabl "$feature_all_video_module" is null, the expression[ x$feature_all_video_module = xy ] is used here. Another choice is[ $feature_all_video_module = "" ]
2 . And operator ### BEGIN /etc/grub.d/41_custom ###
if [ -f${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f$prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
推荐阅读
- Linux|109 个实用 shell 脚本
- linux笔记|linux 常用命令汇总(面向面试)
- Linux|Linux--网络基础
- linux|apt update和apt upgrade命令 - 有什么区别()
- linux|2022年云原生趋势
- Go|Docker后端部署详解(Go+Nginx)
- 开源生态|GPL、MIT、Apache...开发者如何选择开源协议(一文讲清根本区别)
- GitHub|7 款可替代 top 命令的工具