• 0

Bash scripting missing ']'

If you have the simple script like the following :

#!/bin/bash
if [ $foo = 'bar']; then
    echo 'Foo is equal to bar'
fi
And when you run the script, if you get the Missing ']' error it means you are missing a space. The following script should solve your issue. Note extra space after 'bar'
#!/bin/bash
if [ $foo = 'bar' ]; then
    echo 'Foo is equal to bar'
fi