LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-20-2007, 04:17 AM   #1
hraposo
Member
 
Registered: Aug 2004
Posts: 370

Rep: Reputation: 30
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?
 
Old 08-20-2007, 04:57 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986
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").
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
change color vito_huang Linux - General 1 11-13-2004 01:21 PM
java change color alaios Programming 2 05-29-2004 12:45 PM
ls --color 'color change' ekdya Linux - General 1 10-06-2003 03:47 PM
How do i change to high color gonus Linux - Newbie 4 05-11-2002 07:12 PM
how to change bg and fg color in emacs linux_rookie Linux - Software 1 06-23-2001 07:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration