From 3d89bbb553951494babc7f03b723ebcb8659ba87 Mon Sep 17 00:00:00 2001 From: Jack-Benny Persson Date: Wed, 1 Jan 2014 23:57:00 +0100 Subject: [PATCH] Replaced 'whereis' with 'which' for cleaner code (no more awking) --- configure.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.sh b/configure.sh index b62c81d..76e3e90 100755 --- a/configure.sh +++ b/configure.sh @@ -26,13 +26,13 @@ # Variables Binaries=(sed awk egrep mail printf cat grep mktemp rm tail) File="failedlogins.sh" -TempFile=`mktemp -t failedlogins.XXXXXX` +TempFile=`mktemp -t ${File}.XXXXXX` StartBin=8 EndBin=17 # Check that they are all installed for bin in ${Binaries[@]}; do - whereis $bin | awk '{ print $2 }' | grep $bin &> /dev/null + which $bin &> /dev/null if [ $? -ne 0 ]; then echo "It seems you system dosen't have $bin installed" exit 1 @@ -46,7 +46,7 @@ cp $File $TempFile # variables for the script looking like this: Binary="/bin/binary" Index=0 for i in ${Binaries[@]}; do - NewBins[$Index]=$(echo "$i=\"`whereis $i | awk '{ print $2 }'`\"" | \ + NewBins[$Index]=$(echo "$i=\"`which $i`\"" | \ sed "s/\b\(^.\)/\u\1/g") ((Index++)) done