Headlines
Loading...
Program in UNIX to display number of days in that month

Program in UNIX to display number of days in that month

Write a Shell script that accept the month number and display number of days in that month.

echo -n "Enter month number :"
read m
case $m in
[13578] | 1[02])  
        echo "Number of days in $m month are 31";;
2) echo "Enter year"
   read yr
   if [ `expr $yr % 4` -eq 0 ]
   then
        echo "Number of days in $m month are 29"
   else
        echo "Number of days in $m month are 28"
   fi;;
[469] | 11)
         echo "Number of days in $m are 30";;
*) echo "Invalid month number !!!"
esac
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***