18 lines
394 B
Bash
18 lines
394 B
Bash
#!/usr/bin/env bash
|
|
# Print a message in each of the 8 ANSI terminal colors
|
|
|
|
rainbow() {
|
|
local message="$1"
|
|
local reset='\e[0m'
|
|
for ((color=31; color<=37; color++))
|
|
do
|
|
color_code="\\e[0;${color}m"
|
|
if [ -t 1 ]; then
|
|
printf "${color} - ${color_code}${message}${reset}\n"
|
|
else
|
|
printf "${color} - ${message}\n"
|
|
fi
|
|
done
|
|
}
|
|
|