I’m creating a bash script to loop all my packages, and execute their tests.
testAll () {
dir=~/packages;
for f in "$dir"/*
do
cd $f;
sail down;
done;
for f in "$dir"/*
do
cd $f;
sail up;
if MYSQL is EXIST; then
artisan migrate:fresh --seed;
fi
test-all;
sail down;
done;
cd ..;
}
I need to check if mysql is exist, so I can execute "migrate" command. I could only find functions that display the container, but I need a boolean. So, how can I do that.
Thanks in advance.
2
Answers
The solution I came up is the following.
You can try this:
This will return
docker
status, running, up, and exited.