Setting the Bash Prompt

Setting the Bash Prompt

Post by Lekeas G » Wed, 27 Jun 2001 22:01:32



Hi All,

I am using the tcsh shell as my default shell but sometimes I do work with
the bash shell. I tried to set the prompt so that it will display the
hostname, the history number of the command and the dollar symbol. In
order to do that, I typed the following command in both my .profile and
.login files: PS1="(\h)\!$". However, when I execute it the prompt changes
to (\h)\!$.

Could somebody please explain to me why this happens and how can I change
the prompt to get the effect I want?

Thanks in advance.

George

 
 
 

Setting the Bash Prompt

Post by Benjamin.Altma » Thu, 28 Jun 2001 00:11:27



> .login files: PS1="(\h)\!$". However, when I execute it the prompt changes
> to (\h)\!$.

It worked for me.  Are you sure it is a bash shell?

 
 
 

Setting the Bash Prompt

Post by Faux_Pseu » Thu, 28 Jun 2001 17:40:23


--(Once apon a time, in comp.unix.shell,)--
                --(Lekeas GK said it like only they can.)--

Quote:> Hi All,

> I am using the tcsh shell as my default shell but sometimes I do work with
> the bash shell. I tried to set the prompt so that it will display the
> hostname, the history number of the command and the dollar symbol. In
> order to do that, I typed the following command in both my .profile and
> .login files: PS1="(\h)\!$". However, when I execute it the prompt changes
> to (\h)\!$.

> Could somebody please explain to me why this happens and how can I change
> the prompt to get the effect I want?

> Thanks in advance.

> George

I tested it and PS1="(\h)\!$" dose work as designed. notice that you
say that "\h" in the final is not "h".  If this where bash it would
not parse it like that.  If $SHELL is indead bash then there is some
strange voodoo going on and i would recompile bash and see if you get
a differant result.

--

GUI's are for slackers.  ibpconf.sh 6.1 on freshmeat.net  
The easiest way to customize the command line.  By Faux_Pseudo

It's a damn poor mind that can only think of one way to spell a word.
        - Andrew Jackson

 
 
 

1. Setting the Bash prompt?

If you define the tcsh prompt like

         set prompt = "%U....%u"

the characters within the %U and %u will be underlined
when the prompt is displayed. Is there a way to obtain
a similar effect in the bash shell.

By the way, there are in my opinion so many effects
that can be obtained in the unix environment that seem
to be documented nowhere. The above seems to fall into
this category. Please give a reference to some documentation
if you are aware of any.

Best regards

Mads Ipsen

2. emacs key macros

3. Webmaster job in San Diego

4. BASH BASH BASH BASH BASH BASH BASH BASH BASH BASH

5. P3 vs K6-2

6. Setting prompt to current directory in bash

7. Qu. about VisionFS and shared printers

8. setting prompt in bash

9. bash, "set -o vi" and prompt

10. Setting prompt to current directory with bash.

11. Bash prompt string (PS1) setting

12. Q: Setting prompt GLOBALLY for bash