[vox-tech] checking for interactive shell in bash

Ryan vox-tech@lists.lugod.org
Thu, 25 Jul 2002 13:05:36 -0700


-----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 i=
t
> 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.

- --=20
PGP/GPG Fingerprint: 3B30 C6BE B1C6 9526 7A90  34E7 11DF 44F3 7217 7BC7
Available at http://www.cal.net/~ryan/ryan_at_mother_dot_com.asc=20
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9QFoQEd9E83IXe8cRAngOAJ9y85+i5DCqUycLx7nC1yvZwWp1HwCffTOt
LSEHrP1MWzjSySg3ym5AZM0=3D
=3DhE3U
-----END PGP SIGNATURE-----