I'm using macOS. When I open a bash shell and execute echo $-
, it outputs himBH
. What does that mean?
$- (dollar hyphen) bash parameter is used to get current option flags specified during the invocation, by the set built-in command or set by the bash shell itself.
Echoes (prints) the exit value for the previous command. If it failed it will be different than zero ( 0 ).
It shows your Builtin Set Flags. man bash
then look for SHELL BUILTIN COMMANDS and then look for the set subsection
. You will find the meanings of all those flags:
h: Remember the location of commands as they are looked up for execution. This is enabled by default.
i: interactive
m: Monitor mode. Job control is enabled
B: The shell performs brace expansion (see Brace Expansion above). This is on by default
H: Enable ! style history substitution. This option is on by default when the shell is interactive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With