Ok, this is probably going to be ultra obvious to anyone that has spent more time with bash than I have.
I'm trying to run this code:
#!/bin/bash
if ["1" -eq "2"]
then
echo "True"
else
echo "False"
fi
but when I execute the file, it sends back
./test.sh: line 3: 1: command not found
False
There must be something major I'm missing. I've seen people use a semicolon after the brackets, this doesn't seem to make any difference... :S
which [and you'll see. And you can't execute a program with arguments written without a whitespace... (And as others have answered, -eq is for integers only. Which it will tell you when using [ correct)[. The reason is that[is a command -- it's an alias fortest. These days it's a shell builtin but you can find/bin/[on most systems.