Can’t get Terminal to Display Colour (Mavericks)

command linescriptterminal

I've recently been working on a script to backup files, etc. for my own use but recently I thought it may look nicer if I was able to cleanup and have everything nice and tidy (with colours and what not). I was unable to complete this though. In a shell script I have written the following and despite what multiple combos I've tried I am unable to get this working.

Testing this on Mavericks as I can't update to Yosemite yet.

echo '\033Some text'

Can somebody shine a light on this?

Best Answer

Try:

echo $'\e[34m''some text'

or

echo $(tput setaf 1) some text

For more detailed information, see this post: https://superuser.com/questions/33914/why-doesnt-echo-support-e-escape-when-using-the-e-argument-in-macosx