shell script example

【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 ###

    推荐阅读