Last active
August 29, 2015 14:03
-
-
Save jzelner/1132b70977d26a231164 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILE="${1}" | |
if [[ $# != 1 ]]; then | |
echo "Usage: ./render_post.sh <file>" | |
exit | |
fi | |
if [[ ! -f "${FILE}" ]]; then | |
echo "Uh oh, it looks like the file you provided me doesn't exist: ${FILE}" | |
exit | |
fi | |
hash watchmedo 2> /dev/null || { | |
echo "Oh dear. I require Watchdog to work" | |
echo "Install it with:" | |
echo "\t$ pip install watchdog" | |
exit | |
} | |
PATTERN="*.Rmd" | |
KNITR="echo \"Rerunning Knitr...\"; Rscript render_post.R ${FILE}" | |
echo "Watching ${FILE}..." | |
watchmedo shell-command --patterns="${PATTERN}" --command="${KNITR}" . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment