# HG changeset patch # User edhoprima # Date 1268512921 0 # Node ID 4c0fd276665e29b4cbbee51d1cd6858c9a94eb9d # Parent e922fb1e858f9b1b7737c9674d1def5b203f1ab9 - for some reason I broke the getopts logic again. Fixed diff -r e922fb1e858f -r 4c0fd276665e moefetch.sh --- a/moefetch.sh Tue Mar 09 04:37:07 2010 +0000 +++ b/moefetch.sh Sat Mar 13 20:42:01 2010 +0000 @@ -126,7 +126,7 @@ while [ "${__tempnum}" -ge 1000 ]; do __url="http://${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${__iternum}" [ ${_use_login} -eq 1 ] && __url="${__url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}" - wget "${__url}" -O "${TEMP_PREFIX}-xml" -e continue=off || Err_Fatal "Failed download catalog file" + wget --quiet "${__url}" -O "${TEMP_PREFIX}-xml" -e continue=off || Err_Fatal "Failed download catalog file" printf "Processing XML file... " # xslt evilry xsltproc - "${TEMP_PREFIX}-xml" < "${TEMP_PREFIX}-templist" @@ -307,9 +307,9 @@ if [ "$(echo $(wc -l < "${TEMP_PREFIX}-newlist"))" -eq 0 ]; then echo "No new file" else - printf "Starting wget... " + printf "Downloading files... " cd "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}" - wget -e continue=on -bi "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" + wget -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" fi } @@ -345,7 +345,8 @@ TAGS= __has_pass=0 __has_user=0 - while getopts "s:(site)n(noclean)u:(user)p:(password)" opt + x=1 + while getopts "s:nu:p:" opt do case "$opt" in s) SITE="$OPTARG";; @@ -359,7 +360,10 @@ __has_user=1 ;; esac + x=$OPTIND done + shift $(($x-1)) + if [ "$1" = -- ]; then shift; fi TAGS="$@" [ -n "${SITE}" ] || SITE=${DEFAULT_SITE} [ -n "${TAGS}" ] || Err_Fatal "No tag specified"