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.180 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.179 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.178 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.177 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.176 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.175 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.174 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.173 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.172 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.171 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.170 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.169 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.167 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.166 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.165 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.164 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.163 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.162 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.161 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.160 tracks/bash/exercises/leap/example.sh