> Great stuff!
> There was a nice tread on this already started by yourself:
>http://www.linux.ie/pipermail/ilug/2000-October/024065.html thanks,
> Padraig.
Hmm - out of curiosity I went back and re-read this thread. In the initial
message Kenn says:
" cd /build/dir
( make $* ; status=$?) | tee make.log
exit $status
but, of course, the changes to 'status' are local to the () (or {})
construct."
but that's not correct:
diamond at inlinux:~(0)> rpm -q bash
bash-1.14.7-16
diamond at inlinux:~(0)> cat er.sh
#!/bin/bash
( status=4 )
echo status=$status
unset status
{ status=4 }
echo status=$status
unset status
( export status=4 )
echo status=$status
unset status
{ export status=4 }
echo status=$status
unset status
diamond at inlinux:~(0)> ./er.sh
status=
status=4
status=
status=4
diamond at inlinux:~(0)>
That quite clearly shows that vars set inside {}'s are not local. Indeed
after a quick look at the bash man page:
"{ list; }
list is simply executed in the current shell environment."
Anyway - that's all I have to say.
Steve
--
"My mom had Windows at work and it hurt her eyes real bad"
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!