Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


10.3.23 isLeapYear (evaluates to a leap year)

Syntax

isLeapYear  year

Description

This command evaluates whether the year specified for the argument is a leap year.

This command outputs 1 in the following cases:

This command outputs 0.

Arguments

year

This command specifies the character string indicating year.

Output to the standard output

1 or 0.

Return codes

Return code

Meaning

0

Normal termination

Not less than 1

Termination with an error

Notes

A value of more than 0 can be specified for year of argument, but whether the character string can be specified is not verified.

Examples

isLeapYear 2016              # "1" is output.
isLeapYear 2015              # "0" is output.

#: If the value of variable var1 is a leap year, execute UAP1.
result=$(isLeapYear "$var1")
if [[ $result -eq 1 ]]; then
  UAP1
fi