From 2afa0db66f14f4adc9e0f76b893ee0dc580ad557 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 1 Jun 2012 13:36:40 +0200 Subject: calcurse-upgrade: Error out on unknown option Display an error message and bail out if an invalid command line option is passed. Signed-off-by: Lukas Fleischer --- scripts/calcurse-upgrade.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/calcurse-upgrade.sh b/scripts/calcurse-upgrade.sh index 5c7aaea..bf3f92e 100644 --- a/scripts/calcurse-upgrade.sh +++ b/scripts/calcurse-upgrade.sh @@ -4,10 +4,15 @@ export TEXTDOMAIN='calcurse' set -e -if [ "$1" = "--config" ]; then - CONFFILE=$2 -else - CONFFILE=$HOME/.calcurse/conf +CONFFILE=$HOME/.calcurse/conf + +if [ "$#" -gt 0 ]; then + if [ "$1" = "--config" ]; then + CONFFILE=$2 + else + echo "$(gettext "unrecognized option:") \"$1\"" >&2 + exit 1 + fi fi if [ ! -e "$CONFFILE" ]; then -- cgit v1.2.3