Search code examples
linuxbashoperatorsdelimiterlogical-operators

bash command XOR ^ anothercommand


In the example below:

w ^ ls

what's the expected behaviour of the XOR operator in shell?

So when we enter

command ^ anothercommand

what triggers anothercommand to run (if it will execute at all)?


Solution

  • If you enter command ^ anothercommand, you are simply providing command with two arguments, ^ and anothercommand. There is no operator here. anothercommand will only run if command decides to treat that argument as a command name and attempt to run it.