Mercurial > ec-dotfiles
comparison moefetch.sh @ 181:d3b7927bdb2b
restructuring and add check if the xml is processed properly
author | edhoprima@gmail.com <edhoprima@gmail.com> |
---|---|
date | Sun, 28 Jun 2009 05:12:41 +0000 |
parents | 8e6555aa8631 |
children | d92dfe857047 |
comparison
equal
deleted
inserted
replaced
180:8e6555aa8631 | 181:d3b7927bdb2b |
---|---|
85 <xsl:template match="post"> | 85 <xsl:template match="post"> |
86 <xsl:value-of select="@file_url" /> | 86 <xsl:value-of select="@file_url" /> |
87 </xsl:template> | 87 </xsl:template> |
88 </xsl:stylesheet> | 88 </xsl:stylesheet> |
89 EOF | 89 EOF |
90 echo "`echo \`wc -l < \"${SITE_DIR}-${TARGET_DIR}-list\" \`` file(s) available on server" | 90 NUMFILES=`echo \`wc -l < \"${SITE_DIR}-${TARGET_DIR}-list\" \`` |
91 [ "${NUMFILES}" -gt 0 ] || Err_Fatal "Error in processing list or no files can be found with specified tag(s) or site" | |
92 echo "${NUMFILES}" file(s) available on server" | |
91 #output file: ${TARGET_DIR}-list | 93 #output file: ${TARGET_DIR}-list |
92 } | 94 } |
93 | 95 |
94 # check tools availability | 96 # check tools availability |
95 Check_Tools() { | 97 Check_Tools() { |
225 fi | 227 fi |
226 } | 228 } |
227 | 229 |
228 # initialize base variables and initial command check | 230 # initialize base variables and initial command check |
229 Init(){ | 231 Init(){ |
230 # Get base folder - current folder or fallback to ${HOME} | |
231 [ "${BASE_DIR}" ] || BASE_DIR="${PWD}" | |
232 [ "${BASE_DIR}" ] || BASE_DIR="{$HOME}" | |
233 [ "`echo ${BASE_DIR} | cut -c1 | grep \/`" ] || BASE_DIR="/${BASE_DIR}" | |
234 # path initialization | 232 # path initialization |
235 [ "${ADDITIONAL_PATH}" ] && PATH=${ADDITIONAL_PATH}:${PATH} | 233 [ "${ADDITIONAL_PATH}" ] && PATH="${ADDITIONAL_PATH}:${PATH}" |
236 export PATH | 234 export PATH |
237 | 235 |
238 # misc variables | 236 # misc variables |
239 ISQUICK= | 237 ISQUICK= |
240 ISNEW= | 238 ISNEW= |
259 ;; | 257 ;; |
260 *) | 258 *) |
261 SITE="${DEFAULT_SITE}" | 259 SITE="${DEFAULT_SITE}" |
262 ;; | 260 ;; |
263 esac | 261 esac |
262 # Get base folder - default, current folder or fallback to ${HOME} | |
263 [ "${BASE_DIR}" ] || BASE_DIR="${PWD}" | |
264 [ "${BASE_DIR}" ] || BASE_DIR="{$HOME}" | |
265 [ "`echo ${BASE_DIR} | cut -c1 | grep \/`" ] || BASE_DIR="/${BASE_DIR}" | |
266 | |
264 TAGS="$@" | 267 TAGS="$@" |
265 echo "Tags: ${TAGS}" | 268 echo "Tags: ${TAGS}" |
266 # slash is not wanted for folder name | 269 # slash is not wanted for folder name |
267 TARGET_DIR="`echo "${TAGS}" | sed -e 's/\//_/g'`" | 270 TARGET_DIR="`echo "${TAGS}" | sed -e 's/\//_/g'`" |
268 SITE_DIR="`echo "${SITE}" | sed -e 's/\/$//g;s/\//_/g'`" | 271 SITE_DIR="`echo "${SITE}" | sed -e 's/\/$//g;s/\//_/g'`" |
269 } | 272 } |
270 | 273 |
274 # initialization | |
271 Msg_Welcome | 275 Msg_Welcome |
272 Init "$@" | 276 Init "$@" |
273 Check_Tools | 277 Check_Tools |
274 Check_Folders | 278 Check_Folders |
275 | 279 |