aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté <msabate@suse.com>2015-07-28 09:43:54 +0200
committerMiquel Sabaté <msabate@suse.com>2015-07-28 09:43:54 +0200
commit8606da8b5112897f8abddd5bfafd3a8939795621 (patch)
treebd1f2b82fc803b8e9bcf7bd367a33aa205ec58ee
parent3b18f5039369f2bea673b0bcf1c6dcbb459f248f (diff)
downloadg-8606da8b5112897f8abddd5bfafd3a8939795621.tar.gz
g-8606da8b5112897f8abddd5bfafd3a8939795621.zip
Use a proper if-else branch...
-rw-r--r--g.sh18
1 files changed, 10 insertions, 8 deletions
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 <name> [path]"
- return
- fi
- if [ "$#" == "3" ]; then
- path=$3
+ if [ "$#" == "2" ]; then
+ path=`pwd`
+ else
+ if [ "$#" == "3" ]; then
+ path=$3
+ else
+ echo "usage: g add <name> [path]"
+ return
+ fi
fi
get_shortcuts
gshortcuts[$2]=$path