[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pipefail with SIGPIPE/EPIPE
From: |
Greg Wooledge |
Subject: |
Re: pipefail with SIGPIPE/EPIPE |
Date: |
Thu, 23 Mar 2017 12:34:50 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Mar 23, 2017 at 08:50:45AM -0700, Pádraig Brady wrote:
> I was bitten by this again when combined with set -e.
> I.E. this script doesn't finish:
>
> #!/bin/bash
> set -o errexit
> set -o pipefail
> yes | head -n1
> echo finished
>
> That makes the errexit and pipefail options decidedly less useful.
No. It makes errexit less useful. Errexit (a.k.a. set -e) is horrible,
and you should not be using it in any new shell scripts you write.
It exists solely for support of legacy scripts.