Register
It is currently Sat Oct 25, 2014 11:58 pm

[SOLVED] colouring text in a read command/prompt


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Wed Jul 10, 2013 12:53 pm   

Joined: Mon Jul 01, 2013 7:24 pm
Posts: 19
hi,

I often use colour in 'echo' commands with the '-e' switch such as:
Code:
echo -e "\033[1;31msome text\033[0m"

Is there a way to do the same in 'read -p' commands? I tend to include details I want coloured in an 'echo -e ""' command and then issue a 'read -p ""' command, but sometimes it looks pretty ugly and it would be better if I could manage colouring text inside of the 'read' command instead.

cheers


Last edited by naphelge on Fri Jul 12, 2013 5:15 pm, edited 1 time in total.

Top
 Profile  
 PostPosted: Wed Jul 10, 2013 5:05 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 550
hi,

Code:
read -p $'my \033[1;31mcoloured\033[m prompt: '
see man bash /QUOTING


Top
 Profile  
 PostPosted: Fri Jul 12, 2013 5:14 pm   

Joined: Mon Jul 01, 2013 7:24 pm
Posts: 19
Watael wrote:
hi,

Code:
read -p $'my \033[1;31mcoloured\033[m prompt: '
see man bash /QUOTING

Thanks Watael. Made it handy as a vim snip :)


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP