Re: variable assignments and parameter expansion in a single command
From:
Andreas Schwab
Subject:
Re: variable assignments and parameter expansion in a single command
Date:
Sat, 24 Mar 2007 10:03:01 +0100
User-agent:
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux)
Mike Frysinger <vapier@gentoo.org> writes:
> i'm trying to determine whether POSIX allows for utilizing of variables in
> simple commands that were defined earlier in the same command ... in other
> words, whether this snippet:
> unset A B
> A="moo" B="$A more"
> echo $A , $B
> should display moo twice or just once:
> moo , moo more
> moo , more
"Each variable assignment shall be expanded [...] prior to assigning the
value."
That means that each assignment is supposed to be expanded _and_ performed
in the same step while iterating over them.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."