From 4554ce218bbf81cc8d4db19e270819d589ccfb31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 15 Nov 2011 16:18:38 +0100 Subject: easy_e17.sh: find_local_path: count '/' occurences instead of path length --- easy_e17.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easy_e17.sh b/easy_e17.sh index 7cf1d7c..adab900 100755 --- a/easy_e17.sh +++ b/easy_e17.sh @@ -1004,7 +1004,7 @@ function find_local_path () name=$1 re_src_path=$(echo $src_path | sed 's/\//\\\//g') path=$(find $src_path -maxdepth 5 -type d -name $name | sed -e "s/$re_src_path\///" | grep -v -E "^${src_path}$" | grep -v -E "$ignore_dirs_re" | \ - while read line; do echo `echo $line | wc -c` $line; done | sort -n | head -n 1 | cut -d " " -f 2) + while read line; do echo $(echo $line | grep -o '/' | wc -l) $line; done | sort -n | head -n 1 | cut -d " " -f 2) if [ "$path" ]; then echo "$src_path/$path"; fi } -- cgit v1.1-2-g2b99