gsu/gui: Fix regex for tree walk.
authorAndre Noll <maan@systemlinux.org>
Wed, 16 Apr 2014 18:22:38 +0000 (18:22 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 29 Aug 2014 19:39:58 +0000 (21:39 +0200)
If one directory name is a suffix of another, the regex
for grep found both, which is bad.

misc/gsu/gui

index 5b108e1..12c8b8b 100644 (file)
@@ -154,7 +154,7 @@ _get_subtree()
        local tree="$1" root="${2%/}"
        local TAB='     '
 
-       first="$(grep -n "$root/" <<< "$tree")"
+       first="$(grep -n "$TAB\{1,\}$root/" <<< "$tree")"
        [[ -z "$first" ]] && return
 
        line_num="${first%%:*}"