true && {
false
true
 } || echo no

On Sat, May 24, 2025, 4:58 PM Greg Wooledge <g...@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