I’m seeking some assistance implementing a shell script in Hazel. I’ve reached the limit of my current abilities, and I humbly ask for help.
Quick back story. I found Things CLI which is a handy shell script that peeks into Things SQLite database. I use it to turn to-dos into text and then manipulate the result.
What I’m hoping to achieve is to have Hazel watch the Things.sqlite3 file. When the database is modified, I’m trying to run this shell script.
/usr/local/bin/things.sh today | cut -d '|' -f 2 | tr -d '' > "/Volumes/Olgeird/Dropbox/Apps/Things.txt"
things.sh today is the command to pull the to-dos for today.
The terminal result is kind of ugly:
(No Context)|New on Mac|things:///show?id=58E7BFD1-7614-43B5-BC93-DA75992BE49D
So I’m using
tr to extract the to-do name and write the result to a text file in Dropbox.
I’ve had mixed results with the script in Hazel. The script runs occasionally but does not write any text to the text file. More often, the shell script errors. In the log I see:
/usr/local/bin/things.sh: line 70: HOME: unbound variable
I’m unsure what this means or how to fix it. I’m open to suggestions and guidance from the community.
Thanks all. I appreciate you taking time to help.