Skip to content

Instantly share code, notes, and snippets.

@zgulde
Last active December 19, 2017 02:32
Show Gist options
  • Save zgulde/e38f818c5222293e94fa78d8540330ae to your computer and use it in GitHub Desktop.
Save zgulde/e38f818c5222293e94fa78d8540330ae to your computer and use it in GitHub Desktop.
curl -Ss https://gist.githubusercontent.com/zgulde/e38f818c5222293e94fa78d8540330ae/raw/514eb6ae088c0b7467186bf2141684623528d868/print-tomcat-version.sh | bash
#!/bin/bash
run() {
if [[ $(uname -s) != Darwin ]] ; then
echo 'Sorry, this script is for MacOS only.'
exit 1
fi
if ! which catalina >/dev/null ; then
echo 'It looks like tomcat is not installed! Try running:'
echo
echo ' brew install tomcat'
echo
exit 1
fi
if [[ ! -d /usr/local/Cellar/tomcat ]] ; then
echo 'Found the "catalina" command, but /usr/local/Cellar/tomcat does not exist!'
echo 'Did you install tomcat some way other than brew?'
exit 1
fi
most_recent_version="$(ls -1tr /usr/local/Cellar/tomcat | tail -n1)"
cat <<.
Most Recent Tomcat Version: $most_recent_version
Tomcat Home: /usr/local/Cellar/tomcat/$most_recent_version/libexec/
.
}
run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment