Sha256: ed2885c3bc9143fc6e8cf647b861c2e3081d264b4d48c8d9d5bb7641a463a3ac

Contents?: true

Size: 452 Bytes

Versions: 300

Compression:

Stored size: 452 Bytes

Contents

#!/bin/bash

function usage() {
	echo "Usage: raindrops <number>" >&2
	exit 1
}

# check argument is present
if [ ! "$#" -eq 1 ]; then
  usage
fi

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

output=""

if [ $(($1 % 3)) -eq 0 ]; then
	output="Pling"
fi

if [ $(($1 % 5)) -eq 0 ]; then
	output=$output"Plang"
fi

if [ $(($1 % 7)) -eq 0 ]; then
	output=$output"Plong"
fi

if [ -z $output ]; then
	echo $1
else
	echo $output
fi

Version data entries

300 entries across 300 versions & 1 rubygems

Version Path
trackler-2.2.1.42 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.41 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.40 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.39 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.38 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.37 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.36 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.35 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.34 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.33 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.32 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.31 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.30 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.29 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.28 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.27 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.26 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.25 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.24 tracks/bash/exercises/raindrops/example.sh
trackler-2.2.1.23 tracks/bash/exercises/raindrops/example.sh