changeset 235:649b7d4b056a

Use "grep -c ." instead of "echo $(wc -l <" evilry. I should stop trying to fix this script.
author Edho Prima Arief <me@myconan.net>
date Thu, 05 Aug 2010 15:27:07 +0700
parents 58ad057cd2ec
children 515ffebe9bba
files moefetch.sh
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/moefetch.sh	Thu Apr 08 16:30:29 2010 +0700
+++ b/moefetch.sh	Thu Aug 05 15:27:07 2010 +0700
@@ -129,12 +129,12 @@
 </xsl:template>
 </xsl:stylesheet>
 EOF
-		tempnum=$(echo $(wc -l < "${TEMP_PREFIX}-templist"))
+		tempnum=$(grep -c . "${TEMP_PREFIX}-templist")
 		iternum=$((iternum + 1))
 		cat "${TEMP_PREFIX}-templist" >> "${TEMP_PREFIX}-list"
 		echo "${tempnum} file(s) available"
 	done
-	numfiles=$(echo $(wc -l < "${TEMP_PREFIX}-list"))
+	numfiles=$(grep -c . "${TEMP_PREFIX}-list")
 	echo "${numfiles} file(s) available on server"
 	[ "${numfiles}" -gt 0 ] || Err_Fatal "Error in processing list or no files can be found with specified tag(s) or site."
 }
@@ -268,11 +268,11 @@
 		else
 			if [ -n "${has_err_md5}" ]; then
 				echo "${files_error}"
-				echo "$(echo $(wc -l < "${TEMP_PREFIX}-error")) file(s) removed"
+				echo "$(grep -c . "${TEMP_PREFIX}-error") file(s) removed"
 			fi
 			[ -n "${has_err_filename}" ] && echo "${files_notdanbooru}" 
 		fi
-		echo "$(echo $(wc -l < "${TEMP_PREFIX}-ok")) file(s) available locally"
+		echo "$(grep -c . "${TEMP_PREFIX}-ok") file(s) available locally"
 
 		printf "Generating list of new files... "
 		progress_init
@@ -283,7 +283,7 @@
 			progress_anim
 		done < "${TEMP_PREFIX}-ok"
 		progress_done
-		echo "$(echo $(wc -l < "${TEMP_PREFIX}-newlist")) file(s) to be downloaded"		
+		echo "$(grep -c . "${TEMP_PREFIX}-newlist") file(s) to be downloaded"		
 	else
 		if [ -n "${ISQUICK}" ]; then
 			echo "Quick mode selected. Skipping check"
@@ -296,7 +296,7 @@
 
 # start downloading the images
 Fetch_Images() {
-	if [ "$(echo $(wc -l < "${TEMP_PREFIX}-newlist"))" -eq 0 ]; then
+	if [ "$(grep -c . "${TEMP_PREFIX}-newlist")" -eq 0 ]; then
 		echo "No new file"
 	else
 		printf "Downloading files... "