mirror of https://github.com/01-edu/public.git
nprimo
2 years ago
committed by
Niccolò Primo
1 changed files with 14 additions and 0 deletions
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
IFS=' |
||||
' |
||||
|
||||
COLORS=('red' 'blue' 'green' 'white' 'black') |
||||
if [[ ! $1 =~ ^[0-9]+$ ]] || [[ $1 -le 0 ]] || [[ $1 -gt ${#COLORS[@]} ]]; then |
||||
echo 'Error' |
||||
exit 1 |
||||
fi |
||||
|
||||
POS=$(($1 - 1)) |
||||
echo ${COLORS[$POS]} |
||||
|
Loading…
Reference in new issue