Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)?

like image 514
AK_ Avatar asked Feb 28 '17 09:02

AK_


1 Answers

As you can see in man bash, ^ is not used to separate commands, it's used inside arithmetic expressions.

$ echo $(( 5 ^ 9 ))
12

That's because

dec     bin
 5     0101
 9     1001
-----------
12     1100
like image 135
choroba Avatar answered Oct 20 '22 16:10

choroba