Is this Year a Leap Year using Shell Script Commands?

This page answers questions like these:

Is this Year a Leap Year?

if date -d "29 feb" >/dev/null 2>&1 then echo "Yes, this year is a leap year." else echo "No, this year is a not leap year." fi

Is a Given Year a Leap Year?

if date -d "29 feb YYYY" >/dev/null 2>&1 then echo "Yes, YYYY is a leap year." else echo "No, YYYY is a not leap year." fi



Related Links:
What Day of the Week Was It?
Yesterday's Date using Shell Script Commands
Tomorrow's Date using Shell Script Commands

Home  >  Linux / Unix  >  Is this Year a Leap Year using Shell Script Commands?


Tags: leap year, date, shell script, shell command, linux, unix, solaris, bsd, aix

Src: date-leap-years.txt
Dst: Linux-Unix/is-this-year-a-leap-year-using-shell-script-commands.htm
Ads: 3