(easy) webdav saving à la Timimi

Some TiddlyWiki users may find handy to extend this script and have a full history of changes saved in version control as well (it is ugly for fully encrypted wikis, but works nice for plain text ones).

Just like running a file watcher (entr in this case, inotifywait in Linux is a common option as well) in a loop, and copying files when they change, one may as well autocommit the changes to a version control repository.

Here is an example script:

#!/bin/bash

abspath=$(readlink -f "$1")

while true; do
  inotifywait -e modify "$abspath" |\
    git add "$abspath" &&\
    now=$(date) &&\
    git commit -m "$now" "$abspath"
done