写脚本的功力实在是浅,各位请指教,勿喷。😊(权当做个笔记吧)
#!/bin/sh
newName=$1`date +%Y%m%d`
if [ ! $1 ]; then
echo " *** Failed, the arg is null. ***"
else
if [ ! -f $1 ]; then
echo " *** Failed, the file does not exist. ***"
else
if [ ! -f $newName ]; then
/bin/mv $1 $newName
/bin/cp $newName $1
/bin/ls -al $1*
else
if [ ! -f $newName-1 ]; then
/bin/mv $1 $newName-1
/bin/cp $newName-1 $1
/bin/ls -al $1*
else
echo " *** Failed, new file already exist. ***"
/bin/ls $1*
fi
fi
fi
fi
没有评论:
发表评论