Skip to content

Instantly share code, notes, and snippets.

@ahmtcn123
Last active December 16, 2021 11:31
Show Gist options
  • Save ahmtcn123/9b7fb4add9ea84a09102c41ad4fb9df6 to your computer and use it in GitHub Desktop.
Save ahmtcn123/9b7fb4add9ea84a09102c41ad4fb9df6 to your computer and use it in GitHub Desktop.
Print given text chars with random colors
text="Yeyyyyyyyyyyy 6 colorsssss"
max=999
#Iter over 0 and 999
for ((e=0; e<${max}; e++));
do
#Iterate all chars
for (( i=0; i<${#text}; i++ ));
do
#Get int between 31 and 37
randomColorInt=$(shuf -i 31-37 -n 1)
#\e[(randomColor)m(karakter)
echo -n -e "\e[${randomColorInt}m${text:$i:1}"
done
#Add new line
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment