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
yep eq is used only for arithmetic comparaisons.
for string comparison you have to use
#!/bin/bash if [ "1" = "2" ] then echo "True" else echo "False" fi
plus you need some space around the brackets.