xxxxxxxxxx
#!/bin/bash
## run docker, docker-compose, or if newer docker, the compose subcommand of docker.
export cmd='docker-compose'
if ! [ -x "$(command -v $cmd >/dev/null 2>&1)" ]; then export cmd='docker compose'; fi
$cmd build --pull
xxxxxxxxxx
if command -v command1 >/dev/null 2>&1; then
echo "command1 exists."
elif command -v command2 >/dev/null 2>&1; then
echo "command2 exists."
else
echo "Neither command1 nor command2 exists."
fi
xxxxxxxxxx
if command -v <command_name> &>/dev/null; then
echo "Command exists"
else
echo "Command does not exist"
fi