[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Undocumented caret logical operator?
From: |
G. Branden Robinson |
Subject: |
Re: [Help-bash] Undocumented caret logical operator? |
Date: |
Wed, 2 May 2018 14:26:26 -0400 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
At 2018-05-02T14:06:11-0400, Greg Wooledge wrote:
> > echo -n expect FALSE:
> > false ^ true && echo TRUE || echo FALSE
>
> > echo -n expect FALSE:
> > false ^ false && echo TRUE || echo FALSE
>
> It's also a really bad idea to chain && and || in the same command
> like this. It is NOT a synonym for "if ... then ... else ... fi",
> as I explain at <https://mywiki.wooledge.org/BashPitfalls#pf22>.
Yes, that was sloppy of me. I was lashing together the test cases in a
hurry. Meaning it's an even worse habit, as it was an unthinking one!
--
Regards,
Branden
signature.asc
Description: PGP signature
Re: [Help-bash] Undocumented caret logical operator?, Greg Wooledge, 2018/05/02