Ask coding questions

← Back to all posts
How to change the color of text in the terminal using a .sh
JohnS4 (2)

I have this code so far in a main.sh file

while [ true ]; do
  read -p "[email protected]$ " a
  $a
done

and I want to have the [email protected]$ to a different color. How can I do that?

Comments
hotnewtop
Coder100 (18125)

Add the -e flag:

echo -e "\x1b[33mred text\x1b[0m normal text"

click here for an easy bash list.
Click here for the full list :)

Bookie0 (6263)

hi, what language?

JohnS4 (2)

node.js, but I a need to change to color of the main.sh file
@Bookie0