diff moefetch.sh @ 224:0ac1805621d4

fix for FreeBSD
author edhoprima@gmail.com <edhoprima@gmail.com>
date Sat, 18 Jul 2009 09:10:42 +0000
parents 04ad0b0a3c63
children 265a9ca47a19
line wrap: on
line diff
--- a/moefetch.sh	Thu Jul 02 21:32:45 2009 +0000
+++ b/moefetch.sh	Sat Jul 18 09:10:42 2009 +0000
@@ -86,7 +86,7 @@
 	echo "
 Fetching XML file"
 	tempnum=1000
-	_i=1
+	iternum=1
 	> "${TEMP_PREFIX}-list"
 	while [ "${tempnum}" -ge 1000 ]; do
 		wget "http://${SITE}/post/index.xml?tags=${TAGS}&offset=0&limit=1000&page=${_i}" -O "${TEMP_PREFIX}-xml" -e continue=off
@@ -101,7 +101,7 @@
 </xsl:stylesheet>
 EOF
 		tempnum=$(echo $(wc -l < "${TEMP_PREFIX}-templist"))
-		_i=$((_i+1))
+		iternum=$((iternum + 1))
 		cat "${TEMP_PREFIX}-templist" >> "${TEMP_PREFIX}-list"
 		echo "${tempnum} file(s) available"
 	done
@@ -133,13 +133,13 @@
 
 # getting rid of ls (as per suggestion)
 Count_Files() {
-	_i=0
-	for _f in "${*}/"* "${*}/".*; do 
-		if [ "${_f}" != "${*}/*" ] || [ -e "${_f}" ]; then 
-			_i=$((_i + 1))
+	numfiles=0
+	for dircontent in "${*}/"* "${*}/".*; do 
+		if [ "${dircontent}" != "${*}/*" ] || [ -e "${dircontent}" ]; then 
+			numfiles=$((numfiles + 1))
 		fi
 	done
-	echo $((_i - 2))
+	echo $((numfiles - 2))
 }
 
 # check tools availability