# HG changeset patch # User edhoprima@gmail.com # Date 1246276789 0 # Node ID 652d9e268ceecf7302ad98d9e1dc9c6b07b6c080 # Parent a8da494244689ef639304c62d3095472ad00837e test migration to printf diff -r a8da49424468 -r 652d9e268cee moefetch.sh --- a/moefetch.sh Mon Jun 29 10:54:33 2009 +0000 +++ b/moefetch.sh Mon Jun 29 11:59:49 2009 +0000 @@ -60,7 +60,7 @@ # fatal error handler Err_Fatal() { - echo "Fatal error: ${1}" + printf "\nFatal error: ${1}" exit 1 } @@ -83,13 +83,12 @@ # generate link by transforming xml Generate_Link() { - cd "${BASE_DIR}/temp" - echo - echo "Fetching xml file" - wget "http://${SITE}/post/index.xml?tags=${TAGS}&offset=0&limit=100000" -O "${SITE_DIR}-${TARGET_DIR}-xml" -e continue=off - echo "Processing XML file..." + printf "\nFetching xml file\n" + wget "http://${SITE}/post/index.xml?tags=${TAGS}&offset=0&limit=100000" -O "${TEMP_PREFIX}-xml" -e continue=off + printf "Processing XML file..." # xslt evilry - xsltproc - "${SITE_DIR}-${TARGET_DIR}-xml" < "${SITE_DIR}-${TARGET_DIR}-list" + > "${TEMP_PREFIX}-list" + xsltproc - "${TEMP_PREFIX}-xml" < "${TEMP_PREFIX}-list" 2>/dev/null @@ -97,7 +96,7 @@ EOF - NUMFILES=$(echo $(wc -l < "${SITE_DIR}-${TARGET_DIR}-list")) + NUMFILES=$(echo $(wc -l < "${TEMP_PREFIX}-list")) [ "${NUMFILES}" -gt 0 ] || Err_Fatal "Error in processing list or no files can be found with specified tag(s) or site" echo "${NUMFILES} file(s) available on server" #output file: ${TARGET_DIR}-list @@ -305,6 +304,7 @@ # slash is not wanted for folder name TARGET_DIR=$(echo "${TAGS}" | sed -e 's/\//_/g') SITE_DIR=$(echo "${SITE}" | sed -e 's/\/$//g;s/\//_/g') + TEMP_PREFIX="${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}" } # initialization