[vox-tech] checking for interactive shell in bash
Peter Jay Salzman
vox-tech@lists.lugod.org
Thu, 25 Jul 2002 12:48:04 -0700
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.
pete
begin Peter Jay Salzman <p@dirac.org>
> hola,
>
> here's a snippet from my /etc/profile:
>
> # $TERM is set to "dumb" for scp sessions.
> #
> if [ "$TERM" != "dumb" ]; then
>
huge snip