您的位置:首页 > 运维架构 > Shell

shell脚本(一)

2016-08-17 14:42 253 查看
1:实现shell脚本中循环调用函数

#!/bin/bash

output(){
for(( num1=1; num1 <= 5; num1++ ))
do
echo -n "$num1 "
done
}

let "num2=1"
while [ "$num2" -le 5 ]
do
output
echo
let "num2=num2+1"
done


实现结果:



2:判断系统是否存在此文件

#!/bin/bash
#文件系统相关测试

fpath="/etcc/passwd"
if [ -e $fpath ];then
echo File exits;
else
echo Does not exits
fi
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: