I have a bash script, and I can't get the if statement to work correctly.
This is what I have so far.
#!/bin/bash
FILES = 'abc'
if ["$FILES" == "$1"]
then
echo "ok";
fi
Why doesn't this if statement work correctly?
I have a bash script, and I can't get the if statement to work correctly.
This is what I have so far.
#!/bin/bash
FILES = 'abc'
if ["$FILES" == "$1"]
then
echo "ok";
fi
Why doesn't this if statement work correctly?
You need spaces before and after the condition:
if [ "$FILES" == "$1" ]
^^ ^^
Since you are using bash, you can use bash built-in [[
and ]]
instead of the test command [
.