Chinaunix首页 | 论坛 | 博客
  • 博客访问: 73631
  • 博文数量: 5
  • 博客积分: 113
  • 博客等级: 入伍新兵
  • 技术积分: 60
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-09 21:08
文章分类
文章存档

2011年(5)

我的朋友

分类: LINUX

2011-09-12 15:03:35

Normal 0 0 2 false false false EN-US JA X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:標準の表; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0mm 5.4pt 0mm 5.4pt; mso-para-margin:0mm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Century","serif"; mso-ascii-font-family:Century; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Century; mso-hansi-theme-font:minor-latin; mso-font-kerning:1.0pt;}

#!/bin/ksh

 

echo ""

echo "##############################################################################"

echo ""

echo "开始处理 ${1} "

echo "Start Time  is `date`"

echo ""

 

####################################################################################

#######

#######              检查Parameters

#######

####################################################################################

 

echo "--------------------------------"

echo ""

echo "1. Parameters检查"

echo ""

 

 

MONTH=`echo $1 | cut -c 1-2`

DAY=`echo $1 | cut -c 3-4`

P=$#

case $P in

              "1")

                                          if [[ ${MONTH} = 0[1-9] || ${MONTH} = 1[0-2] ]]

                                                        then

                                                                      DO_MONTH=${MONTH}

                                                        else

                                                                      echo "****** Warning ******"

                                                                      echo ""

                                                                      echo "您输入的月份不正确"

                                                                      echo "请输入正确的月份"

                                                                      echo ""

                                                                      exit 3

                                          fi

                                          DO_YEAR=`date +%Y`

                            ;;

              "2")

                                          if [[ ${MONTH} = 0[1-9] || ${MONTH} = 1[0-2] ]]

                                                        then

                                                                      DO_MONTH=${MONTH}

                                                        else

                                                                      echo "****** Warning ******"

                                                                      echo ""

                                                                      echo "$1 为不正确的数值"

                                                                      echo "请输入正确的月份"

                                                                      echo ""

                                                                      exit 3

                                          fi

                                          if [[ $2 = 2[0-9][0-9][0-9] || $2 = 199[0-9] ]]

                                                        then

                                                                      DO_YEAR=$2

                                                        else

                                                                      echo "****** Warning ******"

                                                                      echo ""

                                                                      echo "$2为不正确的数值"

                                                                      echo "19902999范围内输入你想要输入的年份"

                                                                      echo ""

                                                                      exit 3

                                          fi

                            ;;

              *)

                                          echo "****** Warning ******"

                                          echo ""

                                          echo "请检查您的Parameters"

                                          echo "P1 (执行的月和日)  P2 (执行的年份) 不指定第二个年份的时候,按照执行日的年份来计算"

                                          echo ""

                                          exit 3

                            ;;

esac

 

case ${DO_MONTH} in

              "01")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 31 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters "

                                                                                    echo "P1 (执行的月和日)不正确"

                                                                                    echo "0131范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "02")

                                                        RTN_YEAR=$DO_YEAR

                                                        RTN_YEAR=`expr $RTN_YEAR + 0`

                                                        CHK_YEAR_4=`expr $RTN_YEAR % 4`

                                                        CHK_YEAR_100=`expr $RTN_YEAR % 100`

                                                        CHK_YEAR_400=`expr $RTN_YEAR % 400`

                                                        if [ $CHK_YEAR_400 -eq 0 -o $CHK_YEAR_4 -eq 0 -a $CHK_YEAR_100 -ne 0 ]

                                                                      then

                                                                                    if [[ ${DAY} -lt 01 || ${DAY} -gt 29 ]]

                                                                                                  then

                                                                                                                echo "****** Warning ******"

                                                                                                                echo ""

                                                                                                                echo "请检查您的Parameters "

                                                                                                                echo " P1 (执行的月和日)不正确"

                                                                                                                echo "0129范围内输入"

                                                                                                                echo ""

                                                                                                                exit 3

                                                                                    fi

                                                                      else

                                                                                    if [[ ${DAY} -lt 01 || ${DAY} -gt 28 ]]

                                                                                                  then

                                                                                                                echo "****** Warning ******"

                                                                                                                echo ""

                                                                                                                echo "请检查您的Parameters "

                                                                                                                echo " P1 (执行的月和日)不正确"

                                                                                                                echo "0128范围内输入"

                                                                                                                echo ""

                                                                                                                exit 3

                                                                                    fi

                                                        fi

                            ;;

              "03")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 31 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters "

                                                                                    echo " P1 (执行的月和日)不正确"

                                                                                    echo "0131范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "04")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 30 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。"

                                                                                    echo "0130范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "05")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 31 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。"

                                                                                    echo "0131范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "06")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 30 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。。"

                                                                                    echo "0130范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "07")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 31 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。。"

                                                                                    echo "0131范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "08")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 31 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。。"

                                                                                    echo "0131范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "09")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 30 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。。"

                                                                                    echo "0130范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "10")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 31 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。。"

                                                                                    echo "0131范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "11")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 30 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。。"

                                                                                    echo "0130范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

              "12")

                                                        if [[ ${DAY} -lt 01 || ${DAY} -gt 31 ]]

                                                                      then

                                                                                    echo "****** Warning ******"

                                                                                    echo ""

                                                                                    echo "请检查您的Parameters"

                                                                                    echo " P1 (行的月和日)不正确。。"

                                                                                    echo "0131范围内输入"

                                                                                    echo ""

                                                                                    exit 3

                                                        fi

                            ;;

esac

 

echo "Parameters检查结束"

echo ""

阅读(1896) | 评论(0) | 转发(0) |
0

上一篇:pingの仕組み

下一篇:centos 的 ftp设定方法

给主人留下些什么吧!~~