[GLLUG] bash madness

Brian Hoort hoortbri@msu.edu
Fri, 19 Jul 2002 16:16:20 -0400


Well, it's still not working. There was no .profile in my $HOME. (I found 
this unusual, is this normal for Debian?) So I created one as both:
"$HOME/.bashrc", and when that didn't work I tried ". $HOME/.bashrc" as in 
your e-mail (I thought the '.' before was just a typo). I also made it 
'chmod +x .profile'. I still get a generic prompt in unless I run 'bash'.

Any ideas?

At 12:51 PM 7/19/2002, you 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