summaryrefslogtreecommitdiff
path: root/util/find.sh
diff options
context:
space:
mode:
Diffstat (limited to 'util/find.sh')
-rwxr-xr-xutil/find.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/util/find.sh b/util/find.sh
new file mode 100755
index 000000000..d45bea76b
--- /dev/null
+++ b/util/find.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#echo 1>&2
+#echo ::: find.sh "$@" 1>&2
+
+while [[ $# -ne 0 ]]; do
+ if [[ $1 == /* ]]; then
+ unset found
+
+ found=$(echo "${PKG_PATH}:" | while read -r -d ':' path; do
+ if [[ -e ${path}$1 ]]; then
+ if [[ ${found+@} ]]; then
+ echo -n ':'
+ else
+ found=
+ fi
+
+ echo -n "${path}$1"
+ fi
+ done)
+
+ #echo "=== ${found:=$1}" 1>&2
+ echo "${found:=$1}"
+ else
+ echo "$1"
+ fi
+
+ shift
+done
+
+#echo 1>&2