@llplmlyd
        
        2018-10-04T07:24:20.000000Z
        字数 379
        阅读 892
    Shell
测试后是无返回值的,使用 test sth&&echo 0||echo 1 判断测试结果
test <测试表达式> 
test -f  file 
&& ||
[ <内容content> ]  -a -o -gt -lt 
[[ <内容content> ]] && || > < -gt -lt 
(())
特殊测试 表达式 
 [  ]{ 
 ... 
 ... 
}
[[  ]]{ 
... 
... 
}
test <条件>{ 
... 
... 
}
文件测试表达式
6-11 生产环境下 NFS的启动脚本测试
#!/bin/bash/[ -f /etc/sysconfig/network ]&&. /etc/sysconfig/network[ -f /etc/sysconfig/nfs ]&&. /etc/sysconfig/nfs
[ -x /etc/sysconfig/$xxx ]||exit 5
字符串测试表达式 
一定要加双引号再进行比较 
 == 
 = 两侧要有空格 
 != 两侧要有空格
