summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-05-23 16:12:24 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-23 16:12:24 +0200
commit61472a32cdb3e538f954ceb2656d0c41b4cd0b9d (patch)
tree6d114ac1a43f28fc628539b26f1e41b1bcd36e1b /scripts
parent9719de8ea3a88f2968378ff213202737dc9f3dda (diff)
downloadcalcurse-61472a32cdb3e538f954ceb2656d0c41b4cd0b9d.zip
scripts/calcurse-upgrade: Set "-e"
From the set(1p) man page: When this option is on, if a simple command fails for any of the reasons listed in Consequences of Shell Errors or returns an exit status value >0, and is not part of the compound list following a while, until, or if keyword, and is not a part of an AND or OR list, and is not a pipeline preceded by the ! reserved word, then the shell shall immediately exit. This allows us to remove all the "|| exit 1" statements we used to bail out if one command fails. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/calcurse-upgrade14
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/calcurse-upgrade b/scripts/calcurse-upgrade
index 2fa7d4f..1fc481f 100644
--- a/scripts/calcurse-upgrade
+++ b/scripts/calcurse-upgrade
@@ -1,5 +1,7 @@
#!/bin/sh
+set -e
+
CONFFILE=$HOME/.calcurse/conf
if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
@@ -35,8 +37,8 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
-e 's/^output_datefmt=/format.outputdate=/' \
-e 's/^input_datefmt=/format.inputdate=/' \
-e 's/^notify-daemon_enable=/daemon.enable=/' \
- -e 's/^notify-daemon_log=/daemon.log=/' "$CONFFILE" > "$tmpfile" || exit 1
- mv "$tmpfile" "$CONFFILE" || exit 1
+ -e 's/^notify-daemon_log=/daemon.log=/' "$CONFFILE" > "$tmpfile"
+ mv "$tmpfile" "$CONFFILE"
if grep -q -e '^[^#=][^#=]*$' -e '^[^#=][^#=]*#.*$' "$CONFFILE"; then
sed -e '/^general.autosave=/{N;s/\n//}' \
@@ -60,8 +62,8 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
-e '/^format.outputdate=/{N;s/\n//}' \
-e '/^format.inputdate=/{N;s/\n//}' \
-e '/^daemon.enable=/{N;s/\n//}' \
- -e '/^daemon.log=/{N;s/\n//}' "$CONFFILE" > "$tmpfile" || exit 1
- mv "$tmpfile" "$CONFFILE" || exit 1
+ -e '/^daemon.log=/{N;s/\n//}' "$CONFFILE" > "$tmpfile"
+ mv "$tmpfile" "$CONFFILE"
fi
awk '
@@ -70,7 +72,7 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
{ $2 = ($2 == "yes") ? "no" : "yes" }
$1 == "general.firstdayofweek" { $2 = ($2 == "yes") ? "monday" : "sunday" }
{ print }
- ' < "$CONFFILE" > "$tmpfile" || exit 1
- mv "$tmpfile" "$CONFFILE" || exit 1
+ ' < "$CONFFILE" > "$tmpfile"
+ mv "$tmpfile" "$CONFFILE"
fi