X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fgrml%2Fscript-functions;h=887cf2c1fa3743e6dc61ed23635149c78262cb7f;hb=3d5b16f470105b91bac350934155444aa13902e3;hp=a39e3d8a34ce783493e6e836f6baf09d46893fb0;hpb=931ce018a16c8881a4cf963d2b85c4c642627a64;p=grml-etc-core.git diff --git a/etc/grml/script-functions b/etc/grml/script-functions index a39e3d8..887cf2c 100644 --- a/etc/grml/script-functions +++ b/etc/grml/script-functions @@ -48,15 +48,25 @@ setdialog(){ # }}} # {{{ check for availability of program(s) -check4progs(){ - local RC='' - for arg in $* ; do - which $arg >/dev/null 2>&1 || RC="$arg" - done - if [ -n "$RC" ] ; then - echo "$RC not installed" - return 1 - fi +check4progs() { + local RTN=0 + local ARG='' + while [ ${#} -gt 0 ] + do + ARG="${1}" + shift + + # check for availability + if ! \which "${ARG}" >/dev/null 2>&1 + then + printf "%s: binary not found\n" "${ARG}" >&2 + RTN=1 + fi + + done + + # return non zero, if at least one prog is missing! + return ${RTN} } # }}}