diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/expand.c | 4 | ||||
-rw-r--r-- | bin/sh/tests/expansion/Makefile | 1 | ||||
-rw-r--r-- | bin/sh/tests/expansion/cmdsubst23.0 | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 8de5141..05cd3c0 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -768,8 +768,10 @@ again: /* jump here after setting a variable with ${var=text} */ case VSTRIMLEFTMAX: case VSTRIMRIGHT: case VSTRIMRIGHTMAX: - if (!set) + if (!set) { + set = 1; break; + } /* * Terminate the string and start recording the pattern * right after it diff --git a/bin/sh/tests/expansion/Makefile b/bin/sh/tests/expansion/Makefile index c062232..99ed07f 100644 --- a/bin/sh/tests/expansion/Makefile +++ b/bin/sh/tests/expansion/Makefile @@ -44,6 +44,7 @@ ${PACKAGE}FILES+= cmdsubst19.0 ${PACKAGE}FILES+= cmdsubst20.0 ${PACKAGE}FILES+= cmdsubst21.0 ${PACKAGE}FILES+= cmdsubst22.0 +${PACKAGE}FILES+= cmdsubst23.0 ${PACKAGE}FILES+= export1.0 ${PACKAGE}FILES+= export2.0 ${PACKAGE}FILES+= export3.0 diff --git a/bin/sh/tests/expansion/cmdsubst23.0 b/bin/sh/tests/expansion/cmdsubst23.0 new file mode 100644 index 0000000..cde8698 --- /dev/null +++ b/bin/sh/tests/expansion/cmdsubst23.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ + +unset n +x=abcd +[ "X${n#$(echo a)}X${x#$(echo ab)}X$(echo abc)X" = XXcdXabcX ] |