From 8606da8b5112897f8abddd5bfafd3a8939795621 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Date: Tue, 28 Jul 2015 09:43:54 +0200 Subject: Use a proper if-else branch... --- g.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'g.sh') diff --git a/g.sh b/g.sh index c699ecb..4aeaa2a 100644 --- a/g.sh +++ b/g.sh @@ -65,7 +65,7 @@ save_shortcuts() { # The main function for this script. g() { - version="0.3.1" + version="0.3.2" cmd="$1" gfile=$HOME/.gfile declare -A gshortcuts @@ -85,13 +85,15 @@ g() { help ;; add) - path=`pwd` - if [ "$#" != "2" ] && [ "$#" != "3" ]; then - echo "usage: g add [path]" - return - fi - if [ "$#" == "3" ]; then - path=$3 + if [ "$#" == "2" ]; then + path=`pwd` + else + if [ "$#" == "3" ]; then + path=$3 + else + echo "usage: g add [path]" + return + fi fi get_shortcuts gshortcuts[$2]=$path -- cgit v1.2.3