An un-summarized change.
This commit is contained in:
16
tools/inbox_watcher.page
Normal file
16
tools/inbox_watcher.page
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
A tool for running pandoc when a file is saved in an inbox directory:
|
||||||
|
|
||||||
|
~~~ { .shell }
|
||||||
|
#!/bin/sh
|
||||||
|
INBOX=/pub/markdown/inbox
|
||||||
|
OUTBOX=../outbox/
|
||||||
|
PANDOC=/home/levi/bin/pandoc_wrapper
|
||||||
|
cd $INBOX
|
||||||
|
inotifywait -mqre close_write --format '%f' ${INBOX} | while read FILE
|
||||||
|
do
|
||||||
|
echo "Detected write on file: ${FILE}"
|
||||||
|
${PANDOC} ${FILE} ${OUTBOX}
|
||||||
|
done
|
||||||
|
~~~
|
||||||
|
|
||||||
|
The `pandoc_wrapper` is a script that calls pandoc with the appropriate parameters for the document formatting I want to do. It takes a source file and a destination directory as parameters; it automatically creates the destination name based on the source file name and the destination directory.
|
Reference in New Issue
Block a user