root / trunk / util / find.sh

Revision 344, 0.6 kB (checked in by saurik, 5 months ago)

Multiple find.sh matches were being handled poorly.

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3#echo 1>&2
4#echo ::: find.sh "$@" 1>&2
5
6while [[ $# -ne 0 ]]; do
7    if [[ $1 == /* ]]; then
8        unset found
9
10        found=$(echo "${PKG_PATH}:" | while IFS= read -r -d : path; do
11            if [[ -e ${path}$1 ]]; then
12                if [[ ${found+@} ]]; then
13                    echo -n ':'
14                else
15                    found=
16                fi
17
18                echo -n "${path}$1"
19            fi
20        done)
21
22        #echo "=== ${found:=$1}" 1>&2
23        echo "${found:=$1}"
24    else
25        echo "$1"
26    fi
27
28    shift
29done
30
31#echo 1>&2
Note: See TracBrowser for help on using the browser.