Skip to content

Commit

Permalink
Merge pull request #43 from bcoles/patch-2
Browse files Browse the repository at this point in the history
Check required commands exist in $PATH - Fix #31
  • Loading branch information
huntergregal authored Jul 10, 2018
2 parents b090da8 + cc82c8b commit e0ec26c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions mimipenguin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ fi
#Store results to cleanup later
export RESULTS=""

# check if a command exists in $PATH
command_exists () {

command -v "${1}" >/dev/null 2>&1
}

# check for required executables in $PATH
if ! command_exists strings; then
echo "Error: command 'strings' not found in ${PATH}"
exit 1
fi
if ! command_exists grep; then
echo "Error: command 'grep' not found in ${PATH}"
exit 1
fi
if ! command_exists python2; then
echo "Error: command 'python2' not found in ${PATH}"
exit 1
fi

# $1 = PID, $2 = output_file, $3 = operating system
function dump_pid () {
Expand Down

0 comments on commit e0ec26c

Please sign in to comment.