[vox-tech] checking for interactive shell in bash
Peter Jay Salzman
vox-tech@lists.lugod.org
Thu, 25 Jul 2002 13:08:40 -0700
begin Ryan <ryan@mother.com>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thursday 25 July 2002 12:48 pm, Peter Jay Salzman wrote:
> > i just read that testing the length of $PS1 is a way of checking if
> > we're in an interactive shell (zero length means non-interactive, of
> > course).
> >
> > seems like a pretty humble solution, but it appears to work. i guess it
> > hinges on you not setting PS1 before testing it, since /etc/profile *is*
> > read by non-interactive shells. that's a big nota-bene.
>
> As is ~/.profile and ~/.bash_profile.
>
> That's actualy where I set my prompt.......
>
> I'm sure I'm not the only one.
i don't think that would be a problem since the global bash startup
files are read before the per-user bash startup files.
at least i'm pretty sure i remember reading that in man bash awhile ago.
:)
pete
--
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D