commit 6ffbd961377d152e033ce8ba4f978b4d457aa7a5
parent ec52fd254e900eba75bfd01c9d1560503fdff4f8
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sat, 19 Sep 2020 06:43:59 +0200
.profile: remove hurlo output file if hurl was unsuccessful
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.profile b/.profile
@@ -124,8 +124,11 @@ hurlo() {
out="${url##*/}"
[ -z "$out" ] && out="hurl_out"
[ -e "$out" ] && { printf 'error: %s exists\n' "$out" >&2; return 1; }
- hurl "$url" > "$out"
- printf '%s\n' "$out"
+ if ! hurl "$url" > "$out"; then
+ rm "$out"
+ else
+ printf '%s\n' "$out"
+ fi
done
}