Bitwise operators are useful when dealing with bit masks, but in normal practice, they are not so easy to use, and so you will not encounter them very often. However, since they are available in Bash we are going to have a look at them with some examples.
Bitwise operators
Left shift (<<)
The bitwise left shift operators simply multiplies by 2 a value for each shift position; the following example will make everything more clear:
zarrelli:~$ x=10 ; echo $((x<<1))
20
zarrelli:~$ x=10 ; echo $((x<<2))
40
zarrelli:~$ x=10 ; echo $((x<<3))
80
zarrelli:~$ x=10 ; echo $((x<<4))
160
What happened? As we said before, the bitwise operators work on a bit mask, so let's start converting the integer 10 to...