Sha256: 8e42e5c3d941acf4835982137693f194f0236f9daf94c37cc7c191fd77fb4e1f

Contents?: true

Size: 341 Bytes

Versions: 90

Compression:

Stored size: 341 Bytes

Contents

#!/usr/bin/env bash

usage() {
	echo "Usage: leap.sh <year>" >&2
	exit 1
}

# Check number of params
if  [[ "$#" != 1 ]]; then
	usage
fi

# Check if param is an integer
if ! [[ $1 =~ ^[0-9]+$ ]]; then
	usage
fi

if [[ $(($1 % 4)) == 0 ]] \
	&& [[ $(($1 % 100)) != 0 ]] \
	|| [[ $(($1 % 400)) == 0 ]]; then
	echo "true"
else
	echo "false"
fi

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.97 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.96 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.95 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.94 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.93 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.92 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.91 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.90 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.89 tracks/bash/exercises/leap/example.sh