Files
dbtool/samples/locate/locate

22 lines
383 B
Plaintext
Raw Normal View History

2015-05-14 18:34:10 +02:00
#!/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.
#
2015-05-16 00:14:14 +02:00
db="/var/db/locate.db"
regex=$1
2015-05-14 18:34:10 +02:00
2015-05-16 00:14:14 +02:00
if test -n "$regex"; then
dbtool -d $db -S -k $regex -w -R
2015-05-14 18:34:10 +02:00
else
2015-05-16 00:14:14 +02:00
echo "Usage: locate <expression>"
2015-05-14 18:34:10 +02:00
fi