linux 空格

    xiaoxiao2021-04-13  40

    1、定义变量时, =号的两边不可以留空格

    2、if语句,if 及 [ 符号的两边都要留空格。 如判断变量str是否为空字符中: if [ -z $str ];then fi 3、字符串比较, ==两边要留空格 4、变量名不能用 - 5、if中使用test 时,不需要test ,因为  [ ] 就是判断符号 if [ test -z $str ];then   if 写成 if [ -z $str ];then  

    if

    判断中 $str 要写成 “$str”,如果str 中有空格,就会报错

    转载请注明原文地址: https://ju.6miu.com/read-669372.html

    最新回复(0)