set -o出力とset +o出力の違いは何ですか?

set -o出力とset +o出力の違いは何ですか?

私が使用するときset -o

❯ set -o
noaliases             off
aliasfuncdef          off
allexport             off
noalwayslastprompt    off
alwaystoend           on
appendcreate          off
noappendhistory       off
autocd                on
autocontinue          off
noautolist            off
noautomenu            off
autonamedirs          off
noautoparamkeys       off
...

私が使用するときset +o

❯ set +o
set +o noaliases
set +o aliasfuncdef
set +o allexport
set +o noalwayslastprompt
set -o alwaystoend
set +o appendcreate
set +o noappendhistory
set -o autocd
set +o autocontinue
set +o noautolist
set +o noautomenu
...

set -oon/off を使用してset +o+o/-o を使用します。

類似性がわかりますが、なぜ使用されますか+o/-o

ベストアンサー1

あるものはそうなるからです。誰かがそうなると決めました。

If -o is supplied with no option-name, the values of the
current  options are printed.  If +o is supplied with no
option-name, a series of set commands  to  recreate  the
current  option  settings  is  displayed on the standard
output.

+oフォローしたり-o議論したりする場合は、異なる意味を-持ちます。+

おすすめ記事