changeset 251:d7e5a2e70cf3

Proper test for for loop (*, .*)
author Edho Arief <edho@myconan.net>
date Sun, 20 Nov 2011 23:21:19 +0700
parents 4a8d81743728
children 0cd601956a9a
files bin/moefetch.sh
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bin/moefetch.sh	Tue Nov 08 22:31:10 2011 +0700
+++ b/bin/moefetch.sh	Sun Nov 20 23:21:19 2011 +0700
@@ -161,7 +161,7 @@
 Count_Files() {
 	numfiles=0
 	for dircontent in "${*}/"* "${*}/".*; do 
-		if [ "${dircontent}" != "${*}/*" ] || [ -e "${dircontent}" ]; then 
+		if [ -e "${dircontent}" ] && [ x"${dircontent}" != x"${*}/." ] && [ x"${dircontent}" != x"${*}/.." ]; then 
 			numfiles=$((numfiles + 1))
 		fi
 	done
@@ -243,7 +243,7 @@
 		> "${TEMP_PREFIX}-ok"
 		for file in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"*
 		do
-			if [ "${file}" != "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/*" ]; then
+			if [ -e "${file}" ]; then
 				if [ -n "$(is_not_md5 "${file}")" ] || [ -d "${file}" ]; then
 					files_notdanbooru="${files_notdanbooru}
   $(get_basename "${file}")"