Re: pipefail with SIGPIPE/EPIPE

2017-03-23 Thread Jay Freeman (saurik)
> 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. Wow. For those of us who don't know this, what should we be using instead? Is using a trap on ERR any better? Is your suggestion that ||

q// / qq// syntax or built-ins please ?

2017-03-23 Thread Jason Vas Dias
Please , in some future versions of bash, could it provide support / help for avoiding "quoting hell", in such situations as : $ echo " Error: Cannot find file '/missing/file_1'. Error: Cannot find file '/missing/file_2'. " | while read line; do cmd='if [[ '$'"'"$line"$'"'' =~

Re: pipefail with SIGPIPE/EPIPE

2017-03-23 Thread Greg Wooledge
On Thu, Mar 23, 2017 at 07:27:19PM +, Jay Freeman (saurik) wrote: > > 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. > > Wow. For those of us who don't know this, what should we be

Re: pipefail with SIGPIPE/EPIPE

2017-03-23 Thread Pádraig Brady
On 23/03/17 09:34, Greg Wooledge wrote: > 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

Re: pipefail with SIGPIPE/EPIPE

2017-03-23 Thread Pádraig Brady
On 15/02/15 14:14, Pádraig Brady wrote: > On 15/02/15 21:59, Daniel Colascione wrote: >> On 02/15/2015 01:48 PM, Chet Ramey wrote: >>> On 2/13/15 12:19 PM, Pádraig Brady wrote: I was expecting bash to handle SIGPIPE specially here, as in this context it's informational rather than an

Re: pipefail with SIGPIPE/EPIPE

2017-03-23 Thread Greg Wooledge
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