Unix administration - help me to find a unix command

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > May 2007 > help me to find a unix command





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author help me to find a unix command
sartaj123@gmail.com

2007-04-25, 1:20 am

hello,

I am sartaj working in ecredit solutions, can some one tell me
what is the command to change the background and foreground color of
command shell in unix.

Thanks & Regards
Sartaj

Grzegorz Rumatowski

2007-04-25, 7:19 am

On 24 Apr 2007 22:58:01 -0700, sartaj123@gmail.com wrote:

> hello,
>
> I am sartaj working in ecredit solutions, can some one tell me
> what is the command to change the background and foreground color of
> command shell in unix.
>
> Thanks & Regards
> Sartaj


Depends of terminal you are using....
Scott Simpson

2007-04-27, 1:21 pm

<sartaj123@gmail.com> wrote in message
news:1177480681.691882.150640@s33g2000prh.googlegroups.com...
> hello,
> I am sartaj working in ecredit solutions, can some one tell me
> what is the command to change the background and foreground color of
> command shell in unix.


If you are using "xterm", then you can put

XTerm*background: yellow
XTerm*foreground: green

in your ~/.Xdefaults file and when the X server starts up it should read
this file. Resources are also loaded by the xrdb command so if resources are
set by the xrdb command then the .Xdefaults file isn't read. How all this
works is beyond the scope of this posting.


Tobias Freitag

2007-04-28, 1:25 am

sartaj123@gmail.com wrote:

> what is the command to change the background and foreground color of
> command shell in unix.


You can try tput(1), it should work in almost all cases

tput setaf [colornumber] - sets foreground color
tput setab [colornumber] - sets background color

where colornumber is a number from 0 to 9



sartaj123@gmail.com

2007-05-03, 7:20 am

On Apr 28, 11:24 am, Tobias Freitag <tfrei...@gmx.net> wrote:
> sartaj...@gmail.com wrote:
>
> You can try tput(1), it should work in almost all cases
>
> tput setaf [colornumber] - sets foreground color
> tput setab [colornumber] - sets background color
>
> where colornumber is a number from 0 to 9




no the above tput command is not working.....

Dave Hinz

2007-05-03, 7:20 am

On 3 May 2007 02:51:39 -0700, sartaj123@gmail.com <sartaj123@gmail.com> wrote:
> On Apr 28, 11:24 am, Tobias Freitag <tfrei...@gmx.net> wrote:


[vbcol=seagreen]
> no the above tput command is not working.....


You need to define "not working" to have any chance of getting help.
Please read this...it's long, but will help you immensely in getting
more out of Usenet:
"How to ask questions the smart way"
http://www.catb.org/~esr/faqs/smart-questions.html


Chris F.A. Johnson

2007-05-03, 7:21 pm

On 2007-05-03, sartaj123@gmail.com wrote:
> On Apr 28, 11:24 am, Tobias Freitag <tfrei...@gmx.net> wrote:
>
> no the above tput command is not working.....


That's not surprising; the standard for tput does not say anything
about colour. There are many implementations of tput, and they are
not all compatible with each other, and may not have any colour
capabilities.

The standard terminal escape sequences (as defined by ISO-6429 --
formerly ANSI x3.64) are more portable than tput:

black=0
red=1
green=2
yellow=3
blue=4
magenta=5
cyan=6
white=7

fgcolour=$green
bgcolour=$red
printf "\e[3%dm" "$fgcolour" ## set foreground
printf "\e[4%dm" "$bgcolour" ## set background
printf "\e[3%d;4%dm" "$fgcolour" "$bgcolour" ## set both
printf "%s" qwerty ## print something
printf "\e[0m" ## restore defaults


--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
sartaj123@gmail.com

2007-05-10, 1:20 am

On May 3, 11:31 pm, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:
> On 2007-05-03, sartaj...@gmail.com wrote:
>
>
>
>
>
> That's not surprising; the standard for tput does not say anything
> about colour. There are many implementations of tput, and they are
> not all compatible with each other, and may not have any colour
> capabilities.
>
> The standard terminal escape sequences (as defined by ISO-6429 --
> formerly ANSI x3.64) are more portable than tput:
>
> black=0
> red=1
> green=2
> yellow=3
> blue=4
> magenta=5
> cyan=6
> white=7
>
> fgcolour=$green
> bgcolour=$red
> printf "\e[3%dm" "$fgcolour" ## set foreground
> printf "\e[4%dm" "$bgcolour" ## set background
> printf "\e[3%d;4%dm" "$fgcolour" "$bgcolour" ## set both
> printf "%s" qwerty ## print something
> printf "\e[0m" ## restore defaults
>
> --
> Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
> Shell Scripting Recipes: | My code in this post, if any,
> A Problem-Solution Approach | is released under the
> 2005, Apress | GNU General Public Licence




As you posted the commands(tput) in gmail groups(comp.unix.admin) to
change the color of unix terminal is working for current line, please
help me in changing the color throught out the session of the unix
terminal.

Dave Hinz

2007-05-10, 7:29 am

On 9 May 2007 22:20:07 -0700, sartaj123@gmail.com <sartaj123@gmail.com> wrote:

> As you posted the commands(tput) in gmail groups(comp.unix.admin) to
> change the color of unix terminal is working for current line, please
> help me in changing the color throught out the session of the unix
> terminal.


1. This isn't a "gmail group".

2. He doesn't owe you a second answer just because he gave you the first
one; your language seems to imply you feel he does.

3. Go read "How to ask questions the smart way" before it's too late:
http://www.catb.org/~esr/faqs/smart-questions.html

Chris F.A. Johnson

2007-05-10, 1:28 pm

On 2007-05-10, sartaj123@gmail.com wrote:
> On May 3, 11:31 pm, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:

[please trim signatures]
[vbcol=seagreen]
> As you posted the commands(tput) in gmail groups(comp.unix.admin)


This is not a gmail group, nor a Google group; it is a usenet
newsgroup.

> to change the color of unix terminal is working for current line,
> please help me in changing the color throught out the session of the
> unix terminal.


Read the man page for the terminal you are using; you can set the
colours with arguments on the command line or in Xresources (load
or merge changes with xrdb).

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
jen

2007-05-29, 7:23 am

On May 10, 9:22 pm, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:
> On 2007-05-10, sartaj...@gmail.com wrote:
>
>
>
>
>
>
>
>
>
> [please trim signatures]
>
>
> This is not a gmail group, nor a Google group; it is a usenet
> newsgroup.
>
>
> Read the man page for the terminal you are using; you can set the
> colours with arguments on the command line or in Xresources (load
> or merge changes with xrdb).
>
> --
> Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
> Shell Scripting Recipes: | My code in this post, if any,
> A Problem-Solution Approach | is released under the
> 2005, Apress | GNU General Public Licence


tput setaf [colornumber] works perfectly..on FC 5...
thanks

Chris F.A. Johnson

2007-05-29, 7:21 pm

On 2007-05-29, jen wrote:
> On May 10, 9:22 pm, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:
....[vbcol=seagreen]
> tput setaf [colornumber] works perfectly..on FC 5...


It should work on any Linux system, but may not work on other OSes,
such as FreeBSD.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com