Program (monthdays.sh)
# Number of days in a month
mth=`date +%m`
mn=`date +%B`
case $mth in
02)echo "February usually has 28 days"
echo "If leap year, then it has 29 days" ;;
04|06|09|11)echo "The current month $mn has 30 days" ;;
*) echo "The current month $mn has 31 days"
esac
Output
[vijai@localhost command]$ sh monthdays.sh
The current month April has 30 days
# Number of days in a month
mth=`date +%m`
mn=`date +%B`
case $mth in
02)echo "February usually has 28 days"
echo "If leap year, then it has 29 days" ;;
04|06|09|11)echo "The current month $mn has 30 days" ;;
*) echo "The current month $mn has 31 days"
esac
Output
[vijai@localhost command]$ sh monthdays.sh
The current month April has 30 days
No comments:
Post a Comment