BASH change color of text ?
JosephK
joseph at oxtedonline.net
Tue Mar 11 21:11:35 UTC 2008
On 20:24 Tue 11 Mar , dave selby wrote:
> Hi all,
>
> I need to change the terminal text color when printing a warning. So
> far in python the following works a treat ...
>
> print """
> \033[1;32mAll configurations have been regenerated and reloaded.
>
> \033[1;31m*WARNING* If you have changed
> ../apache2_config/kmotion_vhost_template you need to :\n
> sudo /etc/init.d/apache2 restart\033[1;37m\n
> """
>
> However I need a bash script to do the same ...
>
> dave at dev-machine:/var/lib/kmotion/daemons$ print "\033[1;32mkmotion
> has been started\033[1;37m"
> Warning: unknown mime-type for "\033[1;32mkmotion has been
> started\033[1;37m" -- using "application/*"
> Error: no such file "\033[1;32mkmotion has been started\033[1;37m"
> dave at dev-machine:/var/lib/kmotion/daemons$
>
> Can anyone tell me how to get this to work via bash print ?
Bash does not have <print>. Uses echo instead. However, it does have
<printf> which may do what you want.
--
Regards, Joe
More information about the ubuntu-users
mailing list