判断一个文件是否存在,如果不存在就创建:
#!/bin/bash
proclock(){
if [ -e $1 ];then
echo "this file is exist.."
else
echo "this file is not exist,but while be touch.."
touch $1
fi
}
read -p "please input the filename: "
DIR=`dirname $REPLY`
[ ! -d $DIR ] && mkdir -p $DIR
proclock $REPLY
阅读(1271) | 评论(0) | 转发(0) |