shell 判断文件是否存在 并且 循环读取
2012-06-05 10:33
537 查看
#!/bin/sh
if [ $# -gt 1 ]; then 空格也要注意
echo "Uage: $0[FileName]"
exit 1
elif [ $# -eq 1 ]; then
myFileName=$1
echo $myFileName
else
myFileName=$0
echo "/home/hadoop/"$myFileName
fi
if [ ! -f"$file" ];then //!和-f 之间要有空格
echo "$myFileName does not exit!"
exit 1
fi
MY_LINE_NO=1
while read MY_LINE
do
echo "$MY_LINE:$MY_LINE_NO"
MY_LINE_NO=$((MY_LINE_NO+1))
done<$myFileName
if [ $# -gt 1 ]; then 空格也要注意
echo "Uage: $0[FileName]"
exit 1
elif [ $# -eq 1 ]; then
myFileName=$1
echo $myFileName
else
myFileName=$0
echo "/home/hadoop/"$myFileName
fi
if [ ! -f"$file" ];then //!和-f 之间要有空格
echo "$myFileName does not exit!"
exit 1
fi
MY_LINE_NO=1
while read MY_LINE
do
echo "$MY_LINE:$MY_LINE_NO"
MY_LINE_NO=$((MY_LINE_NO+1))
done<$myFileName
相关文章推荐
- shell 脚本判断文件、文件夹是否存在
- shell判断hdfs文件目录是否存在
- shell判断文件,目录是否存在或者具有权限
- shell判断文件是否存在
- Shell判断文件是否存在
- shell 判断文件、目录是否存在
- 如何在shell脚本中判断文件或者文件夹是否存在?
- shell判断文件,目录是否存在或者具有权限
- shell 判断文件、目录是否存在
- shell判断文件是否存在
- shell判断文件,目录是否存在或者具有权限
- shell判断文件是否存在
- shell判断文件,目录是否存在或者具有权限
- shell 判断文件、目录是否存在
- shell 判断文件、目录是否存在
- shell脚本循环判断进程是否存在
- shell判断文件,目录是否存在或者具有权限
- Shell脚本中判断文件,目录是否存在或者具有权限 (原创)
- shell判断文件是否存在
- 如何在shell脚本中判断文件或者文件夹是否存在?