Re: variable assignments and parameter expansion in a single command
From:
Chet Ramey
Subject:
Re: variable assignments and parameter expansion in a single command
Date:
Sat, 24 Mar 2007 14:23:39 -0400
User-agent:
Thunderbird 1.5.0.10 (Macintosh/20070221)
Mike Frysinger wrote:
> 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:
As I read Posix, twice, as long as there are only assignment statements
in the command. Assignment statements preceding simple commands are
treated differently.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/