Closed cbfannin closed 1 year ago
@dalin- I read through the link you provided and it seems they are recommending the way we are already checking for mysql existence. The only thing that is different is how they handle the error. Rather than an if statement like we had, they use conditional or logic. They did mention the which command to see if the path exists but that is not recommended.
What am I overlooking?
@cbfannin
I read through the link you provided and it seems they are recommending the way we are already checking for mysql existence.
My bad. I must've been reading too fast. Your method looks good.
@cbfannin
I read through the link you provided and it seems they are recommending the way we are already checking for mysql existence.
My bad. I must've been reading too fast. Your method looks good.
My confusion is I don't see much difference in what they recommended vs what I originally had. What I originally had:
command -v mysql >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "mysql is not installed."
exit 1
fi
VS what the post recommended:
command -v mysql >/dev/null 2>&1 || { echo >&2 "FAILURE. MySQL is required. Please install mysql locally and run the command again."; exit 1; }
The test is identical. command -v mysql >/dev/null 2>&1
The only difference I see is how the error message is handled. Are you saying both of these are acceptable?
@cbfannin
My confusion is I don't see much difference in what they recommended vs what I originally had.
Exactly. For some reason when I read it the first time I thought you had done
mysql -v >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
What you've got here is great!
This will check if mysql is installed and exit if not when the
pantheon-db-cli
command is executed. I didn't have to have mysql enabled/running for the command to continue to work but please test that again.pantheon-db-cli eam-d8 live
on environment with mysql installed.pantheon-db-cli eam-d8 live
on environment with msyql installed and disabled.pantheon-db-cli eam-d8 live
on environment with msyql uninstalled/removed and notice the message informing the user that mysql is not installed locally.