penguin/utils

my env utils

commit 61c985e1b049994fb8be660844303d71f31e82de

author斟酌 鵬兄 <tgckpg@gmail.com>
date2017-09-22T02:59:14Z
subjectFixed priority lookup in .go_conf
commit 61c985e1b049994fb8be660844303d71f31e82de
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2017-09-22T02:59:14Z

    Fixed priority lookup in .go_conf
---
 bash/bashrc/sources/40_go-command | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/bash/bashrc/sources/40_go-command b/bash/bashrc/sources/40_go-command
index 9137dc9..6c2ec67 100755
--- a/bash/bashrc/sources/40_go-command
+++ b/bash/bashrc/sources/40_go-command
@@ -60,9 +60,8 @@ function go() {
     for ((i = 0; i < ${#LOCS[@]}; i++))
     do
         LOC=${LOCS[i]}
-        LOCATION=$(ls -d "$UDEV/$SITE/$LOC/*$ARG3*/" 2> /dev/null )
+        LOCATION=$(ls -d "$UDEV/$SITE/$LOC/"*"$ARG3"*/ 2> /dev/null )
         if [[ -n "$LOCATION" ]]; then
-            LOCATION="$LOC/$LOCATION"
             break
         fi
     done
@@ -71,7 +70,7 @@ function go() {
     shift; shift
 
     if [[ -n "$LOCATION" ]]; then
-        __dive $CC "$UDEV/$SITE/$LOCATION/" $@
+        __dive $CC "$LOCATION" $@
         return $?
     else
         __dive $CC "$UDEV/$SITE" "$ARG3" $@
@@ -84,6 +83,11 @@ __dive() {
     WDIR=$2
     shift; shift
 
+    if [ -z "$*" ]; then
+        $CC "$WDIR"
+        return $?
+    fi
+
     OIFS=$IFS
     IFS="*"
     PATT="*$**"