1.判断字符串为空 if [ -z "$str" ]; then echo "empty string" fi 2.判断文件是否存在 if [ -f /home/builder/.profile ]; then echo "File exists;" fi 3.逻辑非 if [ ! -f /home/builder/.bash_profile ]; then echo "here!"else echo "te
一句话判断 [ ! $a ] && echo "a is null" 1.判断变量 read -p "input a word :" word if [ ! -n "$word" ] ;then echo "you have not input a word!" else echo "the word you input is $word" fi 或者 #!/bin/sh a= if [ !
1. shell 的$! ,$?, $$,$@ $n $1 the first parameter,$2 the second... $# The number of command-line parameters. $0 The name of current program. $? Last command or function's return value. $$ The program's PID. $!
http://blog.chinaunix.net/uid-7553302-id-183648.html 1 shell 的$! ,$?, $$,$@ $n $1 the first parameter,$2 the second... $# The number of command-line parameters. $0 The name of current program. $? Last command or function'