help with pipes

Gilles Espinasse g.esp at free.fr
Sun Feb 22 00:43:20 PST 2009


----- Original Message ----- 
From: "Robert Connolly" <robert at linuxfromscratch.org>
To: "Hardened LFS Development List" <hlfs-dev at linuxfromscratch.org>
Sent: Sunday, February 22, 2009 3:13 AM
Subject: help with pipes


> Hello. As mentioned before, I have a problem with:
> bzcat ../loop-AES-v3.2e-20090112.diff.bz2 | patch -p1 &&
>
> The && is useless because of the |. I think the && is using the return
value
> from bzcat, and not from patch. Redirection would work, except that the
patch
> is bzip2 compressed. For example:
> patch -p1 < ../loop-AES-v3.2e-20090112.diff
> works, but
> patch -p1 < $(bzcat ../loop-AES-v3.2e-20090112.diff.bz2)
> does not (ambiguous redirect).
>
> Is there another way, aside from decompressing the patch in the sources
> directory?
that work
bzcat ../loop-AES-v3.2e-20090112.diff.bz2 | (patch -p1 && echo ok)

echo ok is just there as a visual check to verify && work as intended.
openswan was using a similar construction to patch the kernel on previous
releases.
that was more like | (cd $(DIR_APP) && patch -p1) and when I forgot the (),
nothing was done.

Gilles

Gilles




More information about the hlfs-dev mailing list