Artificial intelligent assistant

Bash script to monitor file change and execute command I have a folder with a bunch of subfolders, these folders have `asciidoctor` formated files with `.adoc` extension. Every time I made changes to files (which is often) I need to run asciidoctor -q filename.adoc to compile it into HTML format. I am trying to automate the process. so far I have come with this using entr: ls *.adoc | entr asciidoctor -q *.adoc but only works with existing folder not for subfolders. I have tried this variation, but it doesn't work: find . -name '*.adoc' | entr asciidoctor -q *.adoc Any ideas how I could implement this automate process for all the subfolders?

1. Search for '*.adoc' files
2. Test if filename.adoc is newer than filename.html
3. if so, run asciidoctor on it

find . -name '*.adoc' | while read FILE; do [ "${FILE}" -nt "${FILE%adoc}html" ] && asciidoctor -q "${FILE}" ; done





or put in a script:


#! /bin/bash
find . -name '*.adoc' | while read FILE; do
if [ "${FILE}" -nt "${FILE%adoc}html" ]; then
asciidoctor -q "${FILE}"
fi
done


The one-line or the script can be run from crontab each minut:


crontab -e


add a line


* * * * * /home/joe/update_adoc.bash

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0fae06837e5b181a82e82041a14fd5cf