From: Joerg Jaspert Date: Thu, 24 Dec 2015 22:36:15 +0000 (+0100) Subject: local is nice for variables in functions X-Git-Url: https://git.decadent.org.uk/gitweb/?p=dak.git;a=commitdiff_plain;h=4c9cfed0efb18ec218897b9968a6b8ef44afed7c;hp=d27f726c8fdaa37026a059af0c1158ffc547f9f3 local is nice for variables in functions --- diff --git a/config/debian/cron.dinstall b/config/debian/cron.dinstall index 09e9c9b1..fe546cab 100755 --- a/config/debian/cron.dinstall +++ b/config/debian/cron.dinstall @@ -71,17 +71,17 @@ function stage() { ARGS='GO[@]' local "${!ARGS}" - error=${ERR:-"true"} + local error=${ERR:-"true"} ARGS=${ARGS:-""} log "########## DINSTALL BEGIN: ${FUNC} ${ARGS} ##########" - STAGEFILE="${stagedir}/${FUNC}_${ARGS}" + local STAGEFILE="${stagedir}/${FUNC}_${ARGS}" STAGEFILE=${STAGEFILE// /_} if [ -f "${STAGEFILE}" ]; then - stamptime=$(/usr/bin/stat -c %Z "${STAGEFILE}") - unixtime=$(date +%s) - difference=$(( $unixtime - $stamptime )) + local stamptime=$(/usr/bin/stat -c %Z "${STAGEFILE}") + local unixtime=$(date +%s) + local difference=$(( $unixtime - $stamptime )) if [ ${difference} -ge 14400 ]; then log_error "Did already run ${FUNC}, stagefile exists, but that was ${difference} seconds ago. Please check." else