The bash(1) man page for 4.1.5(1) says:
-- If no arguments follow this option, then the positional
parameters are unset. Otherwise, the positional parame‐
ters are set to the args, even if some of them begin
with a -.
- Signal the end of options, cause all remaining args to
be assigned to the positional parameters. The -x and -v
options are turned off. If there are no args, the posi‐
tional parameters remain unchanged.
The first difference is when there are no arguments after the -
or --
. For the former, the existing positional parameters will be unchanged. For the latter, the positional parameters will be cleared.
So set --
clears the positional parameters and set -
is a no-op.
The -v
and -x
settings may be modified by set - ...
. So, if you had set -v
turned on (which causes the shell to print input lines as they are read), it will be turned off by the set - ...
command. set -- ...
will leave it unchanged.
set -x
is more common that set -v
in that set -x
is often used to debug scripts to see exactly what commands are being run. Quite often when debugging a shell script, you would run it with bash -x <script>
. Knowing that set - ...
turns -x
off, you'd probably want to use set -- ...
, since it would be quite unexpected to have -x
turned off as a side effect of another command.
-i
and--interactive
might mean the same thing for a particular command line utility.