LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 03-05-2003, 01:12 PM   #1
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Rep: Reputation: 30
Starting sshd: [ OK ]


Hi all!

I almost finished writing a script. But i was wondering how i can print an "OK" just like starting a service, for example sshd:

Starting sshd: [ OK ]

I want to print the OK in green. It would just look better
Anyone knows how to do this?
 
Old 03-05-2003, 02:00 PM   #2
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
Guess i should have posted this in the programming section
 
Old 03-05-2003, 02:01 PM   #3
rockdw
Member
 
Registered: Nov 2002
Location: Chicago, IL
Distribution: Gentoo, CentOS
Posts: 62

Rep: Reputation: 15
Look in /etc/rc.d/init.d/functions for examples of exactly how this is accomplished. Specifically, search for the functions "action, echo_success" and note the following variable info:

SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"

These are examples of the escape codes for prining in different colors.

look at the man page for echo for details

Last edited by rockdw; 03-05-2003 at 02:09 PM.
 
Old 03-05-2003, 03:25 PM   #4
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
Thanks!

(I already looked in those scripts in /etc/rc.d/init.d/ but i hadn't seen this )
 
Old 03-05-2003, 04:27 PM   #5
rockdw
Member
 
Registered: Nov 2002
Location: Chicago, IL
Distribution: Gentoo, CentOS
Posts: 62

Rep: Reputation: 15
Here is another great link:
http://www.cise.ufl.edu/~ppadala/phd/color.pdf
 
  


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
starting sshd how to.. bruse Linux - Networking 5 04-22-2005 04:26 AM
freebsd halt at Starting sshd blackzone *BSD 3 01-31-2005 05:22 PM
sshd starting twice ryedunn Linux - Software 4 01-30-2005 09:47 PM
Bootup hangs during 'Starting sshd:' Arodef Fedora 3 09-24-2004 11:48 PM
starting sshd on SuSE 7.0 glock19 Linux - General 2 05-02-2002 03:21 PM


All times are GMT -5. The time now is 01:08 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration