that file i cleaned up was actually needed across function calls. did find the place where an error could leave the file lying around, and fixed that instead.
local sortfile=$(mktemp /tmp/zz_checkin_sort.XXXXXX)
sort <"$tempfile" >"$sortfile"
echo "$sortfile"
- \rm "$tempfile" "$sortfile"
+ \rm "$tempfile"
}
# iterates across a list of directories contained in a file (first parameter).
echo -n "[$(pwd)] "
# pass the current directory plus the remaining parameters from function invocation.
$action .
- exit_on_error "performing action $action on: $(pwd)"
+ local retval=$?
+ if [ $retval -ne 0 ]; then
+ rm "$tempfile"
+ (exit $retval) # re-assert the return value as our exit value.
+ exit_on_error "performing action $action on: $(pwd)"
+ fi
popd &>/dev/null
done 3<"$tempfile"