mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 16:58:02 +00:00
15 lines
240 B
Bash
15 lines
240 B
Bash
|
#/usr/bin/env bash
|
||
|
n=$1
|
||
|
valid=0
|
||
|
function is_factor {
|
||
|
local factor=$1 msg=$2
|
||
|
|
||
|
(( n % factor == 0 )) && printf $msg && valid=1
|
||
|
}
|
||
|
|
||
|
is_factor 3 "Pling"
|
||
|
is_factor 5 "Plang"
|
||
|
is_factor 7 "Plong"
|
||
|
|
||
|
(( valid == 0 )) && echo $n || printf '\n'
|