判断是不是数字
Code
判断文件是否存在
if [ -e $filename ]
then
ehcho "$filename existed"
fi
if [ -z $name ]
then
echo '$name is NULL'
fi
then
ehcho "$filename existed"
fi
if [ -z $name ]
then
echo '$name is NULL'
fi
判断路径是否存在
if [ ! -d "$myPath"]; then
mkdir "$myPath"
fi
mkdir "$myPath"
fi
判断两个变量是否相等
if [ "$var1" = "$var2" ]; then
echo '$var1 eq $var2'
else
echo '$var1 not eq $var2'
fi
echo '$var1 eq $var2'
else
echo '$var1 not eq $var2'
fi
请参考:http://www.ibm.com/developerworks/cn/linux/shell/bash/bash-2/index.html
限制一个SHELL实例运行:http://www.blogjava.net/Unmi/archive/2006/10/12/124054.html