Adding color to a shell script?
Is it possible to add color to a shell script so that when a user runs the script, the text is in color
eg:
#!/usr/bin/sh
# game1.sh: Asks user to guess a number 5 times
# Answer is 12 and max tries is 5
count=0 ; counter=0
while ((count < 6 )) ; do
echo "Enjoy my first game!"
echo "Go ahead and guess a number, or hit ctrl c to exit:" 1>&2
read number
if [ $number -eq 8 ] ; then
echo "Congradulations, you guessed the number and get a cookie" ; exit
else
let counter=1
let count=1
echo "Sorry that was incorrect, you have 4 guesses left. Guess another number or press ctrl c to exit:" 1>&2
read number
if [$number -eq 8] ; then
echo "Congradulations, you guessed the number and get a cookie" ; exit
else
let count=2
let counter=2
echo "Sorry that was incorrect, you have 3 guesses left. Guess another number or press ctrl c to exit:" 1>&2
read number
if [$number -eq 8] ; then
echo "Congradulations, you guessed the number and get a cookie" ; exit
else
let count=3
let counter=3
echo "Sorry that was incorrect, you have 2 guesses left. Guess another number or press ctrl c to exit:" 1>&2
if $number -eq 8] ; then
echo "Congradulations, you guessed the number and get a cookie" ; exit
else
let count=4
let counter=4
echo "Sorry that was incorrect, you have 1 guess left. Guess another number or press ctrl c to exit:" 1>&2
if $number -eq 8] ; then
echo "Congradulations, you guessed the number and get a cookie" ; exit
else
let count=5
let counter=5
echo "Thanks for playing." 1>&2
if [ $count -eq $counter ] ; then
break
echo "Play again soon!"
fi
fi
fi
fi
fi
fi
done
|