I\'ve been looking through some of the .bashrc and .profile scripts that come with various Linux distros and am seeing that sometimes they check $-.
Her
From man bash:
-
Expands to the current option flags as specified upon invocation, by the set builtin command, or those set by the shell itself (such as the -i option).
So these are the current options that control the behavior of the shell. In particular:
h: Cache location of binaries in the $PATH. Speeds up execution, but fails if you move binaries around during the shell session.i: The current shell is interactivem: Job control is enabledB: Brace expansion is enabledH: History substitution like !-1