LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Change the color (https://www.linuxquestions.org/questions/linux-general-1/change-the-color-578350/)

hraposo 08-20-2007 04:17 AM

Change the color
 
Hello,

Excuse me for these basic questions that I made, but I want to ask something more:
In my script, appears to the user, the sentence: Wait a little.

This sentence appears in black color… How I can the color on sentence? Which is the command in script?

colucix 08-20-2007 04:57 AM

Assuming you have a standard terminal (e.g. gnome-terminal) and you're writing a script in /bin/bash (please, can you clarify?) a method can be:
Code:

tput setaf 1
echo Hello world\!
tput setaf 0

this should print the string "Hello world!" in red. By this method you have 8 basic colors available, numbered from 0 (black) to 7. The setaf string in the above commands stats for "set ANSI foreground". See man tput and man terminfo for details. The latter contains a list of available colors (see section "Colors").


All times are GMT -5. The time now is 11:26 AM.