summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-11-27 20:47:30 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-11-27 23:03:49 -0500
commit30ad556bfdbd5fefc0fa2451b9e8268b132e39c6 (patch)
treefae34a6c5aa4d2e7869b7f385c504b08b87d1d1f
parente02de80f8a53b51f4c6188a6b7d2943c18ee3032 (diff)
cleanup offlineimap-exit
-rw-r--r--offlineimap-exit.sh11
1 files changed, 5 insertions, 6 deletions
diff --git a/offlineimap-exit.sh b/offlineimap-exit.sh
index 17861ba..7838cd7 100644
--- a/offlineimap-exit.sh
+++ b/offlineimap-exit.sh
@@ -1,11 +1,10 @@
#!/bin/bash
offlineimap='offlineimap'
-output_file="`mktemp`"
-$offlineimap "$@" 2>&1|tee "$output_file"
+output_file="$(mktemp --tmpdir "${0##*/}.XXXXXXXXXX")"
+trap "rm -f $(printf '%q' "$output_file")" EXIT
-[ -z "`grep 'ERROR:' "$output_file"`" ]
-status=$?
-rm "$output_file"
-exit $status
+"$offlineimap" "$@" |& tee "$output_file"
+
+! grep 'ERROR:' "$output_file"