bash 语法使用

1、定义函数时,不需要使用function作为函数的命名。  

  函数不需要形参。

  函数名不能以数字作为开头

    

main()
{
   case $1 in
       4 )
        1_start
           ;;
       8 )
        1_start
        5_start
           ;;
    12 )
        1_start
        5_start
        9_start
           ;; 
       * )
      echo "请输入参数"
           ;;   
   esac
 
}

2、bash在进行变量赋值时,"=" 双边不能出现空格

     

isMount=`mount -a | grep "172.16.0.*"`

if  [ "$isMount" = ""  ]; then 
     mount -o nolock 172.16.0.101:/home /mnt
fi 

cd /mnt/junda/JdLinuxApp/A1627_touchscreen/source/touch_design
原文地址:https://www.cnblogs.com/hzijone/p/5902672.html