Bitwise OR (|)

The bitwise OR operator is similar to an inclusive OR and checks two integers using their binary representation: if there is at least a 1 on the same position for each number, the result will be 1:

zarrelli:~$ x=50 ; y=20; echo $((x|y))
54

As we can see from the following table:

128

64

32

16

8

4

2

1

50

0

0

1

1

0

0

1

0

20

0

0

0

1

0

1

0

0

|

0

0

1

1

0

1

1

0

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.154.151