locate
Click here to get the file
Size
1 kB
-
File type
text/x-sh
File contents
#!/bin/bash
set -o noglob
locate_program=/usr/local/bin/locate
sary_locate_program=sary-locate
db_name=PATH
argv=""
global=0
for arg in $@; do
if [ $arg = "-g" ]; then
global=1
else
argv+=" $arg"
fi
done
if [ $global = 0 ]; then
dir=`pwd`
while : ; do
db="$dir/$db_name"
if [ -f "$db" ]; then
break
fi
db=""
newdir=`dirname $dir`
if [ "$dir" = "$newdir" ]; then
break
fi
dir=$newdir
done
if [ -n "$db" ]; then
argv="-d $db$argv"
if [ -f "$db.ary" ]; then
# delegate
locate_program=$sary_locate_program;
fi
fi
fi
exec $locate_program $argv