View Full Version : [all variants] alittle bash help
December 25th, 2008, 06:06 AM
hey guys, i have a simple i mean real simple bash script, that just tells me the time and date.
but i have echo "XXXXXX" and im wondering if i can change the color of the string im trying to display. instead of it being the default colour of the terminal?
December 25th, 2008, 06:32 AM
Hi, what you need is to tell the console to change colors, which is done through xterm color codes. I googled it and this was the first result:
An example of what you can do is:
echo -e "\033[1;31m$(date)\033[0m"
where the first escape sequence: \033[1;31m sets the foreground color to red, and the last sequence: \033[0m resets the terminal defaults.
December 25th, 2008, 07:32 AM
perfect, thankyou i didnt even know what to look for
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.