2013年4月15日

shell的几个实际小例子

摘要: 1. 写一个脚本,利用循环计算10的阶乘 #!/bin/sh factorial=1 for a in `seq 1 10` do factorial=`expr $factorial \* $a` done echo "10! = $factorial" 注:... 阅读全文

posted @ 2013-04-15 21:41 代码王子 阅读(146) 评论(0) 推荐(0)

shell判断文件是否存在

摘要: 1. shell判断文件,目录是否存在或者具有权限 2. #!/bin/sh 3. 4. myPath="/var/log/httpd/" 5. myFile="/var /log/httpd/access.log" 6. 7. # 这里的-x 参数判断$myPath是否存在并且是否... 阅读全文

posted @ 2013-04-15 17:24 代码王子 阅读(964) 评论(0) 推荐(0)

导航