下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
#判断入参及入参要求是否符合。 if [ "$#" = 5 ]; then #判断用户是否存在 if [ -d ${INIT_HOME}/$1 ]; then echo -e "\033[31mThe user already exists\033[0m" 2>&1 echo "${PreciseTime} $1 $5 ErrAction:\"The user already exists\"" >> $Errlog exit 1 fi #判断时间格式 if [[ "$2" =~ ^[0-9]+$ ]]; then : else echo "第二个参数要求为正整数,单位为月!" echo "${PreciseTime} $1 $5 ErrAction:\"使用时间参数错误\" " >> $Errlog exit 1; fi #判断服务类型 if echo "${services[@]}" | grep -w $3 &> /dev/null ;then : else echo -e "\033[31m不支持的服务类型\033[0m" 2>&1 echo "${PreciseTime} $1 $5 ErrAction:\"不支持的服务类型\"" >> $Errlog exit 1 fi #判断文件代码类型 if [ $4 = "svn" ] || [ $4 = "ftp" ] || [ $4 = "-" ] || [ $4 = "null" ];then : else echo -e "\033[31m不支持的代码类型\033[0m" 2>&1 echo "${PreciseTime} $1 $5 ErrAction:\"不支持的代码类型\"" >> $Errlog exit 1 fi #判断邮箱格式 if [[ `echo $5 | sed -r '/^([a-zA-Z0-9_-])[email protected]([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/!d'` == "" ]]; then echo "邮箱格式不正确!" echo "${PreciseTime} ${init_user} ${user_email} ErrAction:\"邮箱格式不正确\" " >> $Errlog exit 1; fi
以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。