当前位置: 首页 > 工具软件 > awesome-shell > 使用案例 >

shell script example

费秦迟
2023-12-01


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

 类似资料:

相关阅读

相关文章

相关问答