You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

14 lines
223 B

#!/usr/bin/env bash
IFS='
'
COLORS=('red' 'blue' 'green' 'white' 'black')
if [[ ! $1 =~ ^[0-9]+$ ]] || [[ $1 -le 0 ]] || [[ $1 -gt ${#COLORS[@]} ]]; then
echo 'Error'
else
POS=$(($1 - 1))
echo ${COLORS[$POS]}
fi