Fix for the "${unset-var#$(cmd1)}$(cmd2)" runs the wrong command bug.

... From FreeBSD
This commit is contained in:
kre 2017-03-12 04:19:29 +00:00
parent 706a2d4f09
commit df029fcc1b
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: expand.c,v 1.101 2016/03/31 16:16:35 christos Exp $ */
/* $NetBSD: expand.c,v 1.102 2017/03/12 04:19:29 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#else
__RCSID("$NetBSD: expand.c,v 1.101 2016/03/31 16:16:35 christos Exp $");
__RCSID("$NetBSD: expand.c,v 1.102 2017/03/12 04:19:29 kre Exp $");
#endif
#endif /* not lint */
@ -756,8 +756,10 @@ again: /* jump here after setting a variable with ${var=text} */
case VSTRIMLEFTMAX:
case VSTRIMRIGHT:
case VSTRIMRIGHTMAX:
if (!set)
if (!set) {
set = 1; /* allow argbackq to be advanced if needed */
break;
}
/*
* Terminate the string and start recording the pattern
* right after it