cancel
Showing results for 
Search instead for 
Did you mean: 

Prompt

 
SOLVED
Go to solution
Highlighted
Regular Advisor

Prompt

how can we change the colour of our prompt.
4 REPLIES 4
Highlighted
Honored Contributor
Solution

Re: Prompt

hi indrajit

if you are using bash

fallowing url may help you

http://www.unix.com/unix-dummies-questions-answers/46793-colors-prompt-ps1.html


Hasan.
Highlighted
Acclaimed Contributor

Re: Prompt

IMHO you should invest your time in reviewing your older threads - your profile shows

"...have assigned points to 151 of 490 responses to my questions...".

No offense

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Highlighted
Honored Contributor

Re: Prompt

http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/

this link gonna explain u all.
BR,
Kapil
I am in this small bowl, I wane see the real world......
Highlighted
Honored Contributor

Re: Prompt

That depends on what you're using to view the prompt with. The terminal (or the terminal emulator program) can limit your choices: for example, if you're using an old greenscreen terminal, your options are basically limited to black-on-green or green-on-black. There might be a way to make your prompt brighter or dimmer than regular text, but that's about it.

You must find out the necessary terminal control character sequences for your terminal type and embed them to the environment variable that determines the prompt string (in POSIX shells, the primary prompt is defined by the $PS1 variable).

There is one problem: different types of terminals require different control sequences to do the same things. Because of this, embedding raw control sequences is a bad idea.

Using a control sequence that is not correct for your terminal type may just cause some garbage characters to be displayed... or it might cause something unexpected to happen, like clearing your screen. If that happens each time the prompt appears, using the shell will be somewhat difficult.

Instead, you should first make sure that your $TERM environment variable is set up correctly and then use the command "tput" to generate the correct control sequences for your terminal type.

See "man 4 terminfo" to know more about all the possible terminal capabilities, and use the command "untic $TERM" to see what capabilities are known for your currently-selected terminal type.

The standard prompt is defined as
PS1='$ '
Making it bold should work for many terminals:
PS1=$(tput bold)'$ '$(tput sgr0)

MK
MK