Is it possible from within a bash script to check if a mysql database exists. Depending on the result then perform another action or terminate the script?
I also used a slightly different version from chown's.
result=$(mysqlshow --user=root --password=12345 dbname | grep -v Wildcard | grep -ow dbname)
The above executes the given command and assigns the returned value to result. And the w option matches dbname exactly.
result
w
dbname