I need to compare a variable with a string (how hard can it be)
#!/bin/bash
a=22
if ["$a" == "23"]
then
echo yes yes
fi
I get
./x: line 5: [22: command not found
I've tried to remove quotes, or use [[...]]. But whatever I do, I get the command not found error. Any suggestions what I do wrong?
./x: line 3: local: can only be used in a function ./x: line 5: [: missing]'`-eqto compare integers instead of==. Furthermore,==is understood by Bash, but isn't POSIX compliant; use=instead for improved portability.