diff moefetch.sh @ 158:cba73f6a96bb

grep check. OpenSolaris' default grep doesn't support -f
author edhoprima
date Tue, 05 May 2009 17:56:54 +0000
parents ffca564daefa
children 75fe19903b74
line wrap: on
line diff
--- a/moefetch.sh	Sat Apr 25 16:26:00 2009 +0000
+++ b/moefetch.sh	Tue May 05 17:56:54 2009 +0000
@@ -22,7 +22,7 @@
 # requirement: wget, libxslt, md5sum (or md5)
 
 # configs
-# program additional paths for: cut, sed, wc, md5(sum), wget, xsltproc
+# program additional paths for: cut, sed, wc, md5(sum), wget, xsltproc, grep
 extrapath=
 
 # md5 calculation, expected output: <32digit md5><space(s)><filename>
@@ -119,11 +119,13 @@
 
 
 # path initialization
-export PATH=${PATH}:$extrapath
+export PATH=$extrapath:${PATH}
 
 # verify all programs required do indeed exist
+	
+
 # basic tools
-commands="cut sed wc wget xsltproc xargs rm mkdir chown comm"
+commands="cut sed wc wget xsltproc xargs rm mkdir chown comm grep"
 cmderr=" "
 for cmd in $commands
 do
@@ -145,6 +147,20 @@
 	exit 1
 fi
 
+# grep checking
+# originally created for workaround on solaris
+#if [ `uname` = "SunOS" ]; then
+	FAIL=0
+	echo "blah" > superrandomtestfile
+	echo "blah" > superrandomtestfile.2
+	grep -f superrandomtestfile.2 superrandomtestfile > /dev/null 2>&1 || FAIL=1
+	rm superrandomtestfile superrandomtestfile.2 superrandomtestfile.3 > /dev/null 2>&1
+	if [ $FAIL = 1 ]; then
+		echo "Your grep is not compatible. Please install or set path of correct grep"
+		exit 1
+	fi
+#fi
+
 
 # all green (part 1)! let's go (until we check the tag)