[GLLUG] bash madness

Basher584 basher584@basher584.org
Fri, 19 Jul 2002 16:05:13 -0400


This is always a fun HOWTO..

http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/

Shows how you can do things with PROMPT_COMMAND, color, etc.

-Ben


On Fri, Jul 19, 2002 at 12:51:03PM -0700, Ben Pfaff wrote:
> Brian Hoort <hoortbri@msu.edu> writes:
> 
> > I've been trying to customize my bash shell prompt. When I do an export 
> > PS1... it works fine, obviously. However, when I set it in .bashrc and 
> > re-login it does not take effect. A look at .bashrc reveals that:
> > 
> > # ~/.bashrc: executed by bash(1) for non-login shells.
> > 
> > So I presume that logging in is a login shell.
> > 
> > 1) What is a login shell as opposed to a non-login shell;
> 
> A login shell is the one that starts up when you log in.
> Subshells, non-interactive shells, etc., are non-login shells.
> 
> > 2) So why is there a .bashrc if it's not going to be run.
> 
> It's only run for non-login shells.
> 
> > 3) Where do I set PS1, if not in .bashrc
> 
> .profile is executed for login shells.  If you want .bashrc to be
> executed too then just add
>         . $HOME/.bashrc
> as the last line of your .profile.
> 
> About prompts: I use
>         PS1='\u@\h:\w($?)\$ '
> because I like to see who I am logged in as, the host I'm logged
> into, the current directory, and the exit code of the last
> command I ran.
> -- 
> "I was born lazy.  I am no lazier now than I was forty years ago, 
>  but that is because I reached the limit forty years ago.  You can't 
>  go beyond possibility."
> --Mark Twain
> _______________________________________________
> linux-user mailing list
> linux-user@egr.msu.edu
> http://www.egr.msu.edu/mailman/listinfo/linux-user