練習

mailopt=FALSE
interval=60
file=""
while getopts mf:t: option
do
     case "$option"
     in
         m) mailopt=TRUE;;
         t) interval=$OPTARG;;
     f) file=$OPTARG;;
         \?) echo "error";echo $OPTIND
             exit 1;;
     esac
done
if [ -z $file ]
then
     echo "file name is error"
     exit 2
fi
while [ -e $file ]
do
    sleep $interval
done

if [ $mailopt = "TRUE" ]
then
    echo "file exists" | mail f3221783
else
    echo "file exists"
fi
请使用浏览器的分享功能分享到微信等