编写一shell脚本,移动一个文件,如果目标位置存在该文件,则监视该文件,直到文件被删除后才移动该文件
#!/bin/bash
if [ "$1" = "" ] || [ "$2" = "" ]
then
echo "Please enter file name"
exit 1
fi
if [ -e $2 ]
then
echo "The file already exists"
until [ ! -f $2 ]
do
sleep 1
done
fi
if [ ! `mv $1 $2` ]
then
echo "mv sucessful"
else
echo "mv error"
fi