G. Branden Robinson
2018-05-02 17:51:42 UTC
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
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
Regards,
Branden