ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 練習

練習

原创 Linux操作系统 作者:keeking 时间:2010-03-01 16:51:10 0 删除 编辑
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

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7899089/viewspace-628298/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: DB2 730
请登录后发表评论 登录
全部评论

注册时间:2009-07-23

  • 博文量
    194
  • 访问量
    287363