X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fgrml%2Fscript-functions;h=21085b7b3f192fbfb3c1301bd2a0ed7135454897;hb=6b83c3fd03200b08e9adc881d2c30544a4d723f4;hp=a39e3d8a34ce783493e6e836f6baf09d46893fb0;hpb=e5e6e3a2fe13935cd4ca80d274f7cb43bce56950;p=grml-etc-core.git diff --git a/etc/grml/script-functions b/etc/grml/script-functions index a39e3d8..21085b7 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} } # }}} @@ -184,4 +194,4 @@ is_older_than() { #}}} ## END OF FILE ################################################################# -# vim:foldmethod=marker tw=80 ai expandtab shiftwidth=2 tabstop=2 +# vim:foldmethod=marker tw=80 ai expandtab shiftwidth=2 tabstop=8 ft=sh