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?
mysqlshow "test" > /dev/null 2>&1 && echo "Database exists."
Depending on the exit status of the mysqlshow command, it will execute the following echo.