29

I was playing around on the shell when by mistake, I typed echo $- and I got the result himBH. Immediately, I tried all other combinations of symbols along with the $ sign but with no luck. I read this post but I didn't fully understand it. Can someone please epxlain what they mean by 'shell options' and what himBH is supposed to mean?

Much thanks!

Community
  • 1
  • 1
Izy-
  • 1,041
  • 2
  • 16
  • 29
  • 1
    More on options in shell... http://tldp.org/LDP/abs/html/options.html – arpit garg Mar 13 '17 at 05:46
  • 1
    This is not really a dupe of the linked question. Other question already knows what is `$-` but asking specifically about what each character in `$-` is doing vs here the problem is the very meaning of `$-`. – anubhava Jun 10 '22 at 13:54

1 Answers1

59

$- prints The current set of options in your current shell.

himBH means following options are enabled:

  • H - histexpand: when history expansion is enabled
  • m - monitor: when job control is enabled
  • h - hashall: Locate and remember (hash) commands as they are looked up for execution
  • B - braceexpand: when brace expansion is enabled
  • i - interactive: when current shell is interactive
anubhava
  • 761,203
  • 64
  • 569
  • 643