Sha256: 6fa52e07ec863a90e18e58edaa591c9d0bd4ed5006edf2062cf8205090fbfa8e
Contents?: true
Size: 374 Bytes
Versions: 6
Compression:
Stored size: 374 Bytes
Contents
#!/usr/bin/env bash function usage() { echo "Usage: leap.sh <year>" >&2 exit 1 } # check number of params if [ "$#" != 1 ]; then usage fi # check param is an integer if ! [[ $1 =~ ^[0-9]+$ ]]; then usage fi if [ $(($1 % 4)) == 0 ] \ && [ $(($1 % 100)) != 0 ] \ || [ $(($1 % 400)) == 0 ]; then echo "This is a leap year." else echo "This is not a leap year." fi
Version data entries
6 entries across 6 versions & 1 rubygems