Putting colour in your shell

lme@ said:
I like my tcsh prompt like this:
Code:
Sat, 01. Aug 2009,14:10:00
<FreeBSD 8.0-BETA2> [maggie:~]
lars@pts/5 >

The code for this is:
Code:
 set prompt = "\n%d, %D. %w %Y, %P\n<`uname -sr`> [%m:%~]\n%B%U%n@%l%u %#%b "

looks awesome, i have same now, thanks, but i was wondering what is "@pts/0" means, thanks again!
 
I use following prompt
Code:
set prompt='%{^[[1;50;1m%}[%n@%m %D.%w %t %~]%#%{^[[0;0;0m%} '
This gives you prompt like this:
Code:
[alt@forsakens.ru 10.Aug 9:12am ~]>
Its colored and its simple to see history and where is previous command :p

P.S. Thanks to Drunky for `grep` coloring info!
 
I found what is @pts/2 means, wasn't there any man page, but today i was reading book..realy good book from Dru Lavigne "BSD HACKS" so many nice staff in there..anyway, she said like, if you like to know who is in which terminal:
Code:
%who -Hu
NAME             LINE     TIME         IDLE  FROM            
z0ran            pts/0    Aug  8 16:26   .   (:0.0)
z0ran            pts/1    Aug  8 16:32   .   (:0.0)
z0ran            pts/2    Aug  9 23:39 15:42 (:0.0)

not so big deal to share my excitement with forum...i liked the prompt, blame @ime :D
 
MG said:
I like the tab-completion and Ctrl-R history editing of bash. So bash is my root shell.

If your /usr/local is another filesystem, be sure bash is in your root filesystem in case your /usr/local refuses to get mounted for any reason.

OR If you nuke /usr/local/lib , you will lose bash also.
 
I use the followings in .cshrc.

Code:
setenv  LSCOLORS ExGxFxdxCxegedabagExEx
setenv  CLICOLOR yes

set prompt = "[%{\033[0;32m%}%n%{\033[0m%}@%{\033[0;32m%}%m%{\033[0m%}] %{\033[1;33m%}%/\n%{\033[0;32m%}#%{\033[0m%} "
 
tangram said:
Essencially there isn't anything that bash does that t/csh can't do.

Almost. Redirecting stderr is one thing. This can be an issue under some conditions, but normally you won't need it.

After all, I think that tcsh is a better interactive shell than bash. Only for more complex tasks or for scripting, the bourne shell should be used. Often, it will be something like that:

Code:
/some/command | while read line; do ...; done

As for the original question: I don't like colors in a terminal, because they can make the output unreadable. Especially, if you don't like prompts and use xterm background colors to not confuse your ssh sessions.
 
Talking about colorful prompt, wouldn't it be better to use sequences provided by termcap(5)? If terminal type doesn't support colors it would still be readable. Smth like
Code:
if ( $?prompt ) then
    # screen(1) title-string escape sequence
    if ( $term != dumb ) then
        set title_esc='\ek\e\\'
    else
        set title_esc
    endif

    set tc_bold       = `echotc md`
    set tc_red        = `echotc AF 1`
    set tc_green      = `echotc AF 2`
    set tc_yellow     = `echotc AF 3`
    set tc_reset_attr = `echotc me`

    set promptchars = '.!'
    set prompt = "%{$tc_bold%}%{$tc_red%}(%{$tc_yellow%}%~%{$tc_red%})%{$tc_green$title_esc%}%#%{$tc_reset_attr%} "
endif
So, when you fire up your tcsh(1) and colors are not available it would look like
Code:
$ TERM=dumb tcsh
echotc: Unknown capability `md'.
echotc: Unknown capability `AF'.
echotc: Unknown capability `AF'.
echotc: Unknown capability `AF'.
echotc: Unknown capability `me'.
(~). echo hello
hello
 
SirDice said:
AFAIK there's no real reason, changing root's shell is just considered to be bad practice.

If you change root to bash which is in /usr/local/bin and something happens to your system and there is a big old crash you can lose root access because the system can't find the shell...it happened to me once so I learned the hard way :(
 
roddierod said:
If you change root to bash which is in /usr/local/bin and something happens to your system and there is a big old crash you can lose root access because the system can't find the shell...it happened to me once so I learned the hard way :(

If the system cannot find the shell for root it will ask for one ;)
 
Back
Top