On Thu, 2005-06-09 at 01:53, Corinna Vinschen wrote:
On Jun 8 11:44, Max Kaehn wrote:
I wound up using eval, and was thoroughly perplexed at the way
that the first eval seems to get thrown away.
-v, please.
tcsh sh
$ eval date
Thu Jun 9 10:52:23 WEDT 2005
$
Corinna
make -v gives GNU Make 3.80. sh -v doesn't seem to do anything--
the ash man page doesn't mention a verbose or debugging mode.
cygcheck -f /bin/sh reports ash-20040127-1. cygcheck -f /bin/make
reports ash-20040127-1. make --debug doesn't tell anything
interesting. I'm using cygwin1.dll from the cygwin1-20050609.dll.bz2
snapshot. (I wasn't sure if you meant -v for version numbers
or verbose output; I hope what you wanted is somewhere in there.)
I've tried testing this with a pure shell script and I can't reproduce
the problem there. If the cause lies with GNU make, it's pretty
subtle, since the Electric Cloud make program gets the same results.
I'm badly out of practice with the classic Bourne shell, and I
haven't worked with ash before, so I may be missing something basic.
Using this makefile:
---
TESTS = foo bar baz
all:
@i=0; \
eval ; \
for tool in $(TESTS); do \
echo results_$${tool}=$$i; \
eval results_$${tool}=$$i; \
i=`expr $$i + 1`; \
done; \
echo results_foo = $$results_foo; \
echo results_bar = $$results_bar; \
echo results_baz = $$results_baz; \
for tool in $(TESTS); do \
eval result=\$$results_$$tool; \
echo results_$$tool = $$result;\
if [ $${result} -ne 0 ] ; then \
exit $$result; \
fi; \
done;
---
with the 'eval ' line present I get:
fulgurite-xpdbg% make -f /u/cygwin/src/winsup/testsuite/iterate.mak
results_foo=0
results_bar=1
results_baz=2
results_foo = 0
results_bar = 1
results_baz = 2
results_foo = 0
results_bar = 1
make: *** [all] Error 1
Delete the line with 'eval ' and:
fulgurite-xpdbg% make -f /u/cygwin/src/winsup/testsuite/iterate.mak
results_foo=0
results_bar=1
results_baz=2
results_foo =
results_bar = 1
results_baz = 2
results_foo =
[: 0: unknown operand
results_bar = 1
make: *** [all] Error 1
This shell script, on the other hand, works just fine:
---
i=0; \
for tool in foo bar baz; do \
echo results_${tool}=$i; \
eval results_${tool}=$i; \
i=`expr $i + 1`; \
done; \
echo results_foo = $results_foo; \
echo results_bar = $results_bar; \
echo results_baz = $results_baz; \
for tool in foo bar baz; do \
eval result=\$results_$tool; \
echo results_$tool = $result; \
if [ ${result} -ne 0 ] ; then \
exit $result; \
fi; \
done;
---