$- 在 Bash 中是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42757236/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 15:52:31  来源:igfitidea点击:

What does $- mean in Bash?

bashshell

提问by Izy-

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 thispost but I didn't fully understand it. Can someone please epxlain what they mean by 'shell options' and what himBH is supposed to mean?

我在 shell 上玩的时候不小心打错了,我输入echo $-了结果himBH。我立即尝试了所有其他符号组合以及 $ 符号,但没有成功。我读了这篇文章,但我没有完全理解它。有人可以解释一下'shell选项'的含义以及himBH的含义吗?

Much thanks!

非常感谢!

回答by anubhava

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

$-打印当前 shell 中的当前选项集。

himBHmeans following options are enabled:

himBH表示启用以下选项:

  • H- histexpand
  • m- monitor
  • h- hashall
  • B- braceexpand
  • i- interactive
  • H—— histexpand
  • m—— monitor
  • h—— hashall
  • B—— braceexpand
  • i—— interactive