# HG changeset patch # User Edho Prima Arief # Date 1280996827 -25200 # Node ID 649b7d4b056ad5fa6bcccf46ef642e8dfd8d89b8 # Parent 58ad057cd2eca09bdad9740a46c7b865b088299b Use "grep -c ." instead of "echo $(wc -l <" evilry. I should stop trying to fix this script. diff -r 58ad057cd2ec -r 649b7d4b056a moefetch.sh --- 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 @@ 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... "