What does "$-" mean in bash or zsh? -


this question has answer here:

today found variable '$-' random string, don't know stands for.

➜  ~ echo $- 569jnrtxzghikms 

and can't change value:

➜  ~ -='sss' zsh: command not found: -=sss ➜  ~  

and, in docker was:

➜  ~ docker  run --rm -ti ubuntu           root@7084255fd54e:/# echo $- himbh 

or:

➜  ~ docker  run --rm -ti alpine ash / # echo $- smi 

does it's value related system?

$- current options set shell.

from the bash reference manual:

using ‘+’ rather ‘-’ causes these options turned off. options can used upon invocation of shell. current set of options may found in $-.

the remaining n arguments positional parameters , assigned, in order, $1, $2, … $n. special parameter # set n.

the return status 0 unless invalid option supplied.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -