Okay, I'm totally confuggled now. Let's boil this down. Take this simple program:
-------------------- snip snip --------------------/tmp/foo.sh #! /bin/sh echo "OPT = x${OPT}x" echo "CFLAGS= x${CFLAGS}x" -------------------- snip snip --------------------
and invoke it like:
% CFLAGS='one' OPT="two $CFLAGS" /tmp/foo.sh
What do you get? What do you *expect* to get? Am I boiling things down correctly?
On every system I've tested, the following output is what I get:
% CFLAGS='one' OPT="two $CFLAGS" /tmp/foo.sh OPT = xtwo x CFLAGS= xonex
So, why should any of this work anywhere? Should we ever expect $OPT to get the right value?
I haven't followed this, but from the above it appears that if you use the form VAR1=val1 VAR2=val2 ... program args then all of val1, val2, ... are evaluated simultaneously using the previous values of VAR1, VAR2, ... rather than left-to-right. That's mildly surprising but not really upsetting to me. --Guido van Rossum (home page: http://www.python.org/~guido/)