On Thu, May 21, 2009 at 01:19:44PM -0400, Steven W. Orr wrote:
[snip]
> The proper way to deal with this is to:
> 
> * Source in your .bashrc from your .bash_profile
> * Set all of your environment variables in your .bash_profile
> * Check in your .bashrc to see if PS1 is set. If not then you are not in 
> an interactive session and you need to set critical environment variables. 

Just BTW, a *much* more reliable way to check for an interactive
session, which will not fail in many common cases (PS1 set in system-wide
config files, PS1 also set in .bashrc, PS1 set in the environment of
the calling shell, etc.), is the following:

# First, set up all variables for both interactive and non-interactive
# sessions.
# Then, do this:
case "$-" in
        *i*)
                echo 'Setting up interactive shell params..'
                stty erase ^H
                ;;
        *)
                # Non-interactive session, better don't output anything
                something_or_other=foo
                ;;
esac

Of course, substitute your own commands for the "stty" and the assignment :)

Bear in mind that this only applies to Bourne-style shells;
for tcsh, you might need to resort to testing for ($?prompt), indeed.

G'luck,
Peter

-- 
Peter Pentchev  r...@ringlet.net    r...@space.bg    r...@freebsd.org
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
What would this sentence be like if pi were 3?

Attachment: pgpiBXmYxCrAT.pgp
Description: PGP signature

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to