首页 > 系统服务 > 详细

shell中test的使用

时间:2015-07-07 19:09:42      阅读:269      评论:0      收藏:0      [点我收藏+]

#/secondin/secondfirstsh
echo “please enter two numseconder”
read first
read second
if test $first -eq $second
then echo “NO.1 = NO.2″
elif test $first -gt $second //判定其是否大于
then echo “NO.1 > NO.2″

else echo “NO.1 < NO.2″
fi
例2.查找/root/目录下是否存在该文件
#/secondin/secondfirstsh
echo “enter first file nfirstme:”
read first
if test  -e /root/$first  //其中的-e 代表存在这个文件
then echo “the file is exist!”
else echo “the file is not exist!”
fi

shell中test的使用

原文:http://www.cnblogs.com/haoxing990/p/4627608.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!