Skip to content

Instantly share code, notes, and snippets.

@sharapeco
Created October 31, 2014 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharapeco/000cdff7b7efa7cc4179 to your computer and use it in GitHub Desktop.
Save sharapeco/000cdff7b7efa7cc4179 to your computer and use it in GitHub Desktop.
check_commands.sh
#!/bin/sh
# @param $1 = command
function command_exists() {
if type $1 > /dev/null 2>&1; then
return 1
else
return 0
fi
}
# @param $1 = command
# @param $2 = application name
function check_command() {
command_exists $1
if [ $? -ne 1 ]; then
echo
echo "ERROR: $2 is not installed"
echo
exit 1
fi
echo "$2 ... installed"
}
echo "================================================================"
echo " Checking commands"
echo "================================================================"
check_command perl "Perl"
check_command convert "ImageMagick"
check_command gs "GhostScript"
check_command platex "pLaTeX"
check_command dvipdfmx "dvipdfmx"
check_command ffmpeg "ffmpeg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment