sh: Recognize "--" as end of options in local builtin.

This commit is contained in:
jilles 2013-08-14 21:59:48 +00:00
parent 1201f3dac8
commit c71191e0d9
2 changed files with 13 additions and 0 deletions

View File

@ -710,6 +710,7 @@ localcmd(int argc __unused, char **argv __unused)
{
char *name;
nextopt("");
if (! in_function())
error("Not in a function");
while ((name = *argptr++) != NULL) {

View File

@ -0,0 +1,12 @@
# $FreeBSD$
f() {
local -- x
x=2
[ "$x" = 2 ]
}
x=1
f || exit 3
[ "$x" = 1 ] || exit 3
f || exit 3
[ "$x" = 1 ] || exit 3