mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 13:57:59 +00:00
377850d0d1
I also forget to add the additional solutions from the Exercism exercises. Whoops... I'm also getting used to storing code in random places. Time to change that habit a little bit by storing them in my notebook, instead. Nothing wrong with that, yeah?!
18 lines
273 B
Bash
Executable File
18 lines
273 B
Bash
Executable File
#/usr/bin/env bash
|
|
n=$1
|
|
valid=0
|
|
function is_factor {
|
|
local factor=$1
|
|
shift
|
|
|
|
local msg=$@
|
|
|
|
[[ $(( $n % $factor )) -eq 0 ]] && printf $msg && valid=1
|
|
}
|
|
|
|
is_factor 3 "Pling"
|
|
is_factor 5 "Plang"
|
|
is_factor 7 "Plong"
|
|
|
|
[[ $valid -eq 0 ]] && echo $n || printf '\n'
|