On Thu, 14 Apr 2005 16:42:22 -0500 Caleb Tennis <[EMAIL PROTECTED]> wrote: | use blah && ( emake foo || die )
Here's what The Doc will have to say about this:
``die`` and Subshells
---------------------
.. Warning:: ``die`` **will not work in a subshell**.
The following code will not work as expected, since the ``die`` is
inside a subshell: ::
[[ -f foorc ]] && ( update_foorc || die "couldn't update foorc" )
The correct way to rewrite this is to use an ``if`` block: ::
if [[ -f foorc ]] ; then
update_foorc || die "couldn't update foorc"
fi
When using pipes, a subshell is introduced, so the following is unsafe:
::
cat list | while read file ; do epatch ${file} ; done
Using input redirection (see `Abuse of cat`_) avoids this problem: ::
while read file ; do epatch ${file} ; done < list
--
Ciaran McCreesh : Gentoo Developer (Vim, Fluxbox, shell tools)
Mail : ciaranm at gentoo.org
Web : http://dev.gentoo.org/~ciaranm
pgpq5pebe4T9s.pgp
Description: PGP signature
