[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash: trap vs. tee



On 2008-07-13 18:44 +0200, Stefan Schmidt wrote:

>> In bash you can change this behavior with "set -o pipefail".
>
> Thanks a lot, that works like a treat!

One caveat, however: this option was introduced in bash 3, so it will
not work with older versions.  And of course you need to make sure that
your script starts with #!/bin/bash and not #!/bin/sh.

To the shell gurus on this list: what can be done in other shells that
do not support this nice feature?  Is it necessary to refrain from using
the pipe at all if the exit code of the first command in it matters?

Sven


Reply to: