bug-bash
[Top][All Lists]
Advanced

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

Re: grouping via {} fails after "test $PIPESTATUS"


From: microsuxx
Subject: Re: grouping via {} fails after "test $PIPESTATUS"
Date: Sat, 24 May 2025 19:03:51 +0200

 true && {
false
true
 } || echo no

On Sat, May 24, 2025, 4:58 PM Greg Wooledge <greg@wooledge.org> wrote:

> On Sat, May 24, 2025 at 10:43:39 -0400, Steve Newcomb wrote:
> > true && {
> >     echo here 1
> >     test "$PIPESTATUS" "!=" "0"
> >     #echo here 2
> > } || {
> >     echo here 3
> > }
>
> Don't do that.  <https://mywiki.wooledge.org/BashPitfalls#pf22>
>
> && || is NOT a substitute for if.  They do not have the same semantics.
> You can't replace one with the other.
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]