Q. How do I write Shell Script to find leap year
Ans:
#!/bin/bash echo -e "enter year " read year #if year is less than or equal to 0 then current year is assigned to year variable if [ $year -le 0 ] ; then year=`date | cut -d " " -f6` fi if [ `expr $year % 400` -eq 0 ]; then echo "$year is a Leap year" elif [ `expr $year % 100` -eq 0 ]; then echo "$year is not a Leap year" elif [ `expr $year % 4 ` -eq 0 ]; then echo "$year is not a Leap year" else echo "$year is not a leap year" fi
Output
Enjoy :)
If You Liked This Post Please Take a Time To Share This Post
Đơn vị vận chuyển gửi hàng từ việt nam sang Hoa Kỳ
ReplyDeleteCông ty vận chuyển gửi hàng từ việt nam sang Lôn-đôn chi phí rẻ
Đơn vị ship nhanh hàng hóa từ việt nam sang thái lan chi phí thấp