I'm getting a bash error when performing a conditional if statment that checks is the current Flask db migration is upgraded or not.
#!/bin/bash
# create folders
mkdir log
# migrate the database
source .env
if ! [ python manage.py db current | grep -q '(head)' ]; then
python manage.py db upgrade
fi
The error is:
./install.sh: line 9: [: missing `]'
grep: ]: No such file or directory
I've read similar posts about this error and the mmost common error is the espace between brackets and the command but I have those spaces.