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.139 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.138 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.137 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.136 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.135 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.134 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.133 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.132 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.131 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.130 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.129 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.128 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.127 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.126 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.125 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.124 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.123 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.122 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.121 tracks/bash/exercises/leap/example.sh
trackler-2.2.1.120 tracks/bash/exercises/leap/example.sh