Files
dbtool/samples/locate/locate
2015-05-16 00:14:14 +02:00

22 lines
383 B
Bash
Executable File

#!/bin/sh
#
# simple locate alike
# written as an example how to
# use dbtool.
#
# locate searches the database
# for a file which matches a
# certain string. The parameter
# to locate can be a fully perl-
# compliant regular expression.
#
db="/var/db/locate.db"
regex=$1
if test -n "$regex"; then
dbtool -d $db -S -k $regex -w -R
else
echo "Usage: locate <expression>"
fi