sh: Apply variable assignments left-to-right in bltinlookup().

Example:
  HOME=foo HOME=bar cd
This commit is contained in:
Jilles Tjoelker 2010-09-11 14:15:50 +00:00
parent 9a24dc0760
commit 011d162dd3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212467
2 changed files with 8 additions and 1 deletions

View File

@ -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)

View File

@ -0,0 +1,3 @@
# $FreeBSD$
[ "$(HOME=/etc HOME=/ cd && pwd)" = / ]