diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-23 12:04:45 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-23 12:04:45 +0200 |
commit | 8d3d601c4fc9bc99b6188bab028681c73c7a3807 (patch) | |
tree | d72c6c9dc262b4b8438c3b3fcfef2d47cea5f614 | |
parent | 2339f066a071bc683f8683b634f8508a4ab054c4 (diff) | |
download | bin-8d3d601c4fc9bc99b6188bab028681c73c7a3807.zip bin-8d3d601c4fc9bc99b6188bab028681c73c7a3807.tar.gz |
easy_e17.sh: rewrite find_local_path
-rwxr-xr-x | easy_e17.sh | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/easy_e17.sh b/easy_e17.sh index 72c8021..6334bf7 100755 --- a/easy_e17.sh +++ b/easy_e17.sh @@ -898,21 +898,9 @@ function run_command () function find_local_path () { name=$1 - path="" - for dir in `find "$src_path" -maxdepth 3 -type d -name "$name" | awk -F "$src_path" '{print $2}'`; do - found=0 - for idir in $ignore_dirs; do - topdir=`echo "$dir" | cut -d'/' -f1` - if [ "$topdir" == "$idir" ]; then found=1; fi - done - if [ $found == 1 ]; then continue; fi - - if [ "${#dir}" -lt "${#path}" ] || [ -z "$path" ]; then - path=$dir - fi - done - - if [ "$path" ]; then echo "$src_path/$path"; fi + path=$(find $src_path -maxdepth 5 -type d -name $pkg | 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) + if [ "$path" ]; then echo "$path"; fi } function compile () |