#!/bin/bash
read -p "请输入查询的年份>>" Y
read -p "请输入查询的月份>>" M
if[$Y-lt 0 ]
then
echo"输入的年份有误,请重新输入!!!"exit
fi
if[$M-lt 1 -o $M-gt 12 ]
then
echo"输入的月份有误,请重新输入!!!"exit
fi
case $M in
4)echo"$Y年$M月共有30天";;
6)echo"$Y年$M月共有30天";;
9)echo"$Y年$M月共有30天";;
11)echo"$Y年$M月共有30天";;
2)if[ $((Y%4))-eq 0 -a $((Y%100))-ne 0 ]||[ $((Y%400))-eq 0 ]
then
echo"$Y年$M月共有29天"elseecho"$Y年$M月共有28天"
fi
;;*)echo"$Y年$M月共有31天";;
esac