From 7f3d7e5158a0fed2dfc1155ca1b21ade4bf4782e Mon Sep 17 00:00:00 2001 From: alarig Date: Sun, 6 May 2018 12:03:49 +0200 Subject: [PATCH] Factoring --- check_deps.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/check_deps.sh b/check_deps.sh index 9051415..2b4b4c0 100755 --- a/check_deps.sh +++ b/check_deps.sh @@ -1,16 +1,14 @@ #/bin/sh check_bin_in_path() { - if [ -z $(which $1 2>/dev/null) ]; then - MISSING="${MISSING} $1" - fi + for bin in $1; do + if [ -z $(which ${bin} 2>/dev/null) ]; then + MISSING="${MISSING} ${bin}" + fi + done } -check_bin_in_path eix-sync -check_bin_in_path emerge -check_bin_in_path grep -check_bin_in_path cat -check_bin_in_path restart-services -check_bin_in_path sendmail +check_bin_in_path "eix-sync emerge grep echo cat lsof awk sort" +check_bin_in_path "restart-services sendmail rm" printf "You’r missing this:${MISSING}\n"