Write a shell script, which receives any year as a argument and determines whether the year is leap or not. If no argument is supplied assume the current year as an argument.
val=$1 if [ $# -eq 0 ] then val=`date | cut -f 6 -d " "` fi value=`echo $val % 4 | bc` if [ $value -eq 0 ] then echo "Leap year"else echo "Not leap year" fi ------------------------------------------------------------------- output ------------------------------------------------------------------- Not leap year