sh: Apply variable assignments left-to-right in bltinlookup().
Example: HOME=foo HOME=bar cd
This commit is contained in:
parent
107ea66c07
commit
694b7e6c37
@ -431,11 +431,15 @@ bltinlookup(const char *name, int doall)
|
||||
{
|
||||
struct strlist *sp;
|
||||
struct var *v;
|
||||
char *result;
|
||||
|
||||
result = NULL;
|
||||
for (sp = cmdenviron ; sp ; sp = sp->next) {
|
||||
if (varequal(sp->text, name))
|
||||
return strchr(sp->text, '=') + 1;
|
||||
result = strchr(sp->text, '=') + 1;
|
||||
}
|
||||
if (result != NULL)
|
||||
return result;
|
||||
for (v = *hashvar(name) ; v ; v = v->next) {
|
||||
if (varequal(v->text, name)) {
|
||||
if ((v->flags & VUNSET)
|
||||
|
3
tools/regression/bin/sh/execution/var-assign1.0
Normal file
3
tools/regression/bin/sh/execution/var-assign1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
|
||||
[ "$(HOME=/etc HOME=/ cd && pwd)" = / ]
|
Loading…
x
Reference in New Issue
Block a user