The idea is to perform indexing of filetrees while excluding certain directories. I want to give the user a simple conf file instead of having to edit the script itself. This is what I came up with:
conf.file:
cache
home/files
program:
#!/usr/bin/env bash
function get_opts {
while read opt
do
echo "-path /data/data/com.termux/$opt -prune -o \\" >> fn_temp
done < conf.file
}
function build_search_fn {
touch fn_temp
echo "function do_search {" > fn_temp
echo "find /data/data/com.termux \\" >> fn_temp
get_opts
echo "-print" >> fn_temp
echo "}" >> fn_temp
}
build_search_fn
source fn_temp
do_search >> output
It does what I want, but I have a strong feeling that it's not the 'proper' way of doing it. Besides the obvious lack of putting the base path into variables and some errorhandling I'm eager to learn about other approaches to do this.