comparison moefetch.sh @ 153:7b07448e46f1

fix: when there is no error file
author edhoprima
date Sat, 25 Apr 2009 16:03:42 +0000
parents 67df02877319
children 8bca9dc8c20d
comparison
equal deleted inserted replaced
152:67df02877319 153:7b07448e46f1
73 fi 73 fi
74 printf "." 74 printf "."
75 done 75 done
76 echo 76 echo
77 cd ../temp 77 cd ../temp
78 totalerr=`wc -l < $tags-error` 78 totalerr=`echo \`wc -l < "$outdir-error"\``
79 echo "$totalerr file(s) error" 79 echo "$totalerr file(s) error"
80 80
81 echo "Generating list of new files..." 81 echo "Generating list of new files..."
82 # THE FILES 82 # THE FILES
83 #ls "../$outdir" | grep -vf "$outdir-error" > "$outdir-ok" 83 #ls "../$outdir" | grep -vf "$outdir-error" > "$outdir-ok"
86 comm -1 -2 "$outdir-list" "$outdir-error" > "$outdir-newlist" 86 comm -1 -2 "$outdir-list" "$outdir-error" > "$outdir-newlist"
87 echo "`echo \`wc -l < \"$outdir-newlist\"\`` file(s) to be downloaded" 87 echo "`echo \`wc -l < \"$outdir-newlist\"\`` file(s) to be downloaded"
88 cd "../$outdir" 88 cd "../$outdir"
89 89
90 echo "Removing error files" 90 echo "Removing error files"
91 if [ $totalerr -gt 0 ] 91 if [ $totalerr -eq 0 ]; then
92 then 92 echo "No error file. 0 file removed"
93 elif [ $totalerr -gt 0 ]; then
93 cat "../temp/$outdir-error" | xargs rm 94 cat "../temp/$outdir-error" | xargs rm
95 echo "$totalerr file(s) removed"
94 fi 96 fi
95 echo "$totalerr file(s) removed"
96 echo "`echo \`ls | wc -l\`` file(s) available locally" 97 echo "`echo \`ls | wc -l\`` file(s) available locally"
97 cd .. 98 cd ..
98 else 99 else
99 if [ $ISQUICK -eq 1 ]; then 100 if [ $ISQUICK -eq 1 ]; then
100 echo "quick mode selected. Skipping check" 101 echo "quick mode selected. Skipping check"