mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
7.28k stars 346 forks source link

interp: panic on set builtin with the end of options flag #817

Closed dhanusaputra closed 2 years ago

dhanusaputra commented 2 years ago

close #816

mvdan commented 2 years ago

Thanks for the patch! Unfortunately this is not quite right, as per help set:

      -   Assign any remaining arguments to the positional parameters.
          The -x and -v options are turned off.

That is, your added test should succeed with:

$ set - foobar
$ echo "$@"
foobar