In bash, you need to use color escape sequences with echo -e
random_colors.sh
#!/bin/bash
TXT='the quick brown fox jumped over the lazy dog.'
WORDS=( $TXT )
for WORD in "${WORDS[@]}"; do
let "i=$RANDOM % 256"
echo -en "\e[38;5;${i}m$WORD \e[0m";
done;
echo
Running this 10 times:
for i in `seq 1 10`; do bash random_colors.sh; done
Output
To get a particular palette, you will need to restrict the set of color numbers.
solved How to randomly generate ANSI colors in Bash/Perl?