I am using zsh and if I type setopt it shows
autocd
nobeep
extendedglob
interactive
login
monitor
shinstdin
zle
- counts 8.
while if I type echo $- it shows :
569BJXZilms
- counts 11.
Why $- gives more options?
setopt will only show the options which are changed from the default:
Options that are on by default for the emulation are shown with the prefix
noonly if they are off, while other options are shown without the prefixnoand only if they are on. In addition to options changed from the default state by the user, any options activated automatically by the shell (for example,SHIN_STDINorINTERACTIVE) will be shown in the list.
The options which are on by default are marked with a <Z> in the zshooptions(1) manpage. For example:
NOTIFY (-5, ksh: -b) <Z>
which appears in $-, but not in the output of setopt.