comparison bin/moefetch.sh @ 251:d7e5a2e70cf3

Proper test for for loop (*, .*)
author Edho Arief <edho@myconan.net>
date Sun, 20 Nov 2011 23:21:19 +0700
parents 515ffebe9bba
children
comparison
equal deleted inserted replaced
250:4a8d81743728 251:d7e5a2e70cf3
159 159
160 # getting rid of ls (as per suggestion) 160 # getting rid of ls (as per suggestion)
161 Count_Files() { 161 Count_Files() {
162 numfiles=0 162 numfiles=0
163 for dircontent in "${*}/"* "${*}/".*; do 163 for dircontent in "${*}/"* "${*}/".*; do
164 if [ "${dircontent}" != "${*}/*" ] || [ -e "${dircontent}" ]; then 164 if [ -e "${dircontent}" ] && [ x"${dircontent}" != x"${*}/." ] && [ x"${dircontent}" != x"${*}/.." ]; then
165 numfiles=$((numfiles + 1)) 165 numfiles=$((numfiles + 1))
166 fi 166 fi
167 done 167 done
168 echo $((numfiles - 2)) 168 echo $((numfiles - 2))
169 } 169 }
241 has_err_md5= 241 has_err_md5=
242 > "${TEMP_PREFIX}-error" 242 > "${TEMP_PREFIX}-error"
243 > "${TEMP_PREFIX}-ok" 243 > "${TEMP_PREFIX}-ok"
244 for file in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"* 244 for file in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"*
245 do 245 do
246 if [ "${file}" != "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/*" ]; then 246 if [ -e "${file}" ]; then
247 if [ -n "$(is_not_md5 "${file}")" ] || [ -d "${file}" ]; then 247 if [ -n "$(is_not_md5 "${file}")" ] || [ -d "${file}" ]; then
248 files_notdanbooru="${files_notdanbooru} 248 files_notdanbooru="${files_notdanbooru}
249 $(get_basename "${file}")" 249 $(get_basename "${file}")"
250 has_err_filename=1 250 has_err_filename=1
251 else 251 else