Recognizing non-interactive shells and 'shell levels'The issue of when bash sources your The traditional approach to do this is to set environment variables to
signal what state you're in and how many things have been initialized.
One traditional 'have I been initialized' variable is (To keep clutter down, your 'am I a login shell' environment variable doesn't need to be exported, and indeed can be unset immediately after you use it. Other flag variables generally need to persist into future sub-shells.) If you need to know interactive versus non-interactive, there are two
approaches. First, you can check the shell's built in The good news about modern systems is that all of this is much less important than it used to be; these days the overhead of re-doing redundant initializations, even relatively complex ones, is usually pretty low. (Netbooks and other small machines may yet change this back, of course.) |
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |