diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-14 17:01:11 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-14 17:42:03 +1200 |
commit | 776eb986b8f56f1a6bdf530f09cc0c371753c74b (patch) | |
tree | 5272f367452da3d3b727b5972b70c0d577ed5b27 | |
parent | Search for needed commands in PATH (diff) | |
download | psshd-776eb986b8f56f1a6bdf530f09cc0c371753c74b.tar.gz psshd-776eb986b8f56f1a6bdf530f09cc0c371753c74b.zip |
Loop through commands rather than repeating
-rwxr-xr-x | psshd | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -21,14 +21,13 @@ self=psshd PATH=/usr/lib/autossh/autossh:/sbin:$PATH # Check we have access to the required binaries -if ! type -p autossh >/dev/null; then - printf '%s - Could not find autossh in PATH\n' "$script" >&2 - exit 127 -fi -if ! type -p start-stop-daemon >/dev/null; then - printf '%s - Could not find start-stop-daemon in PATH\n' "$script" >&2 - exit 127 -fi +cmds=(autossh start-stop-daemon) +for cmd in "${cmds[@]}"; do + if ! type -p "$cmd" >/dev/null; then + printf '%s - Could not find %s in PATH\n' "$self" "$cmd" >&2 + exit 127 + fi +done # Get port in options while getopts ':p:' opt |