help-bash
[Top][All Lists]
Advanced

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

[Help-bash] Undocumented caret logical operator?


From: G. Branden Robinson
Subject: [Help-bash] Undocumented caret logical operator?
Date: Wed, 2 May 2018 13:51:42 -0400
User-agent: NeoMutt/20170113 (1.7.2)

Can someone tell me what is going on here?  This operator is not
documented in SUSv4 nor in the Bash man page, at least not per my
full-text search.  The experiments show that it is not acting as an
"undocumented synonym for |" (bashref re: SVR4.2's Bourne shell), and
the behavior does not change from a script or with set +o history, so
it's not a null version of the ^foo^bar history operator.  We can also
rule out arithmetic expansion (bitwise xor) and glob expansion
(character class inversion), as we're in the wrong lexical context.

dash and ksh93 behave identically.  What am I missing?  What use cases
does it serve?

echo -n expect TRUE:
true ^ true && echo TRUE || echo FALSE
echo -n expect TRUE:
true ^ false && echo TRUE || echo FALSE
echo -n expect FALSE:
false ^ true && echo TRUE || echo FALSE
echo -n expect FALSE:
false ^ false && echo TRUE || echo FALSE

echo -n expect no output and no diagnostic:
false ^ echo OUTPUT
echo

echo -n expect OUTPUT and no diagnostic:
false ^ nonexistent-command | echo OUTPUT

-- 
Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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