How do you define a binary number in a shell script?
I tried it with the 0b
prefix, but that doesn't work for some arbitrary reason.
Octal and hex works fine.
Here's the code I'm trying to run:
#!/bin/sh
test=0b0010;
value=0b0001;
if [ $((value & test)) > 0 ]; then
echo "true";
else
echo "false";
fi
Also, I'm new to shell scripts and is there any better or "proper" way to check if a bit is set?