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