[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
variable assignments and parameter expansion in a single command
From: |
Mike Frysinger |
Subject: |
variable assignments and parameter expansion in a single command |
Date: |
Sat, 24 Mar 2007 04:34:45 -0400 |
User-agent: |
KMail/1.9.6 |
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
my reading of the POSIX spec says this is OK, but i'd like to hear more from
people who like to read this sort of thing for fun :)
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_01
specifically the part where it says that the statement is evaluated from
beginning to end of the command text and that each variable assignment should
be expanded individually
-mike
pgp2PR2ZHKtEg.pgp
Description: PGP signature
- variable assignments and parameter expansion in a single command,
Mike Frysinger <=