set -i, -s do not make sense, bash does not accept them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

dash accepts "set -i" and "set -s", and their +OPT forms.

The -s/+s does not seem to do anything except affecting
the value of $-.

The -i/+i does have some effects. In interactive shell,
"set +i" makes prompt disappear. In non-interactive shell,
"set -i" makes it possible to ^C break the script and
land user into interactive input prompt (!):

$ PS1='T>' dash -c 'set -i; echo $-; sleep 5; echo $-'
i
^C
T> _

>From code inspection, this seems to be caused by
's' and 'i' being present in optletters[] array,
and parsing code treating them as "set" options,
not special-cased.

IOW: it does not appear to be intentional.

bash does not treat them as "set" options.
They are only valid in startup command line, not in
"set" command. dash does the same with -c option.

bash adds "i", "s" and "c" into the value of $-,
despite them not being "set" options.

dash does not do so, resulting in discrepancy of not showing
"c" if e.g. "dash -c 'echo $-'" is run.

I propose to mimic bash behavior more closely:
do not accept "set -i" and "set -s", show "c" in $-.



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux