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: Greg Wooledge
Subject: Re: grouping via {} fails after "test $PIPESTATUS"
Date: Sat, 24 May 2025 10:58:04 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

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]