diff options
author | FRIGN <dev@frign.de> | 2016-09-19 22:51:45 +0200 |
---|---|---|
committer | FRIGN <dev@frign.de> | 2016-09-19 22:51:45 +0200 |
commit | e9db1f49b75b183c8aeda321ca54aff5b436a4f6 (patch) | |
tree | 551aa485d16b2d364539115c49c65aee7468d8e1 /2ff | |
parent | 48c52a1f4889858ae3466f1987b522e426b6ddf3 (diff) |
2ff: use trap to remove temporary file
This also frees us from having to store the return value somewhere.
Diffstat (limited to '2ff')
-rwxr-xr-x | 2ff | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -5,6 +5,8 @@ if [ "$#" -ne 0 ]; then fi TMP=$(mktemp) +trap 'rm "$TMP"' EXIT + cat > "$TMP" if [ "$(dd if="$TMP" bs=1 count=8 2>/dev/null)" = "farbfeld" ]; then @@ -26,11 +28,9 @@ image/jpeg) ;; esac -ret=$? -rm "$TMP" - -if [ $ret -ne 0 ]; then +if [ $? -ne 0 ]; then printf "%s: failed to convert from %s\n" "$0" "$FORMAT" >&2 + exit 1 fi -exit $ret +exit 0 |