1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 02:29:06 -08:00
rc/sh/autosync
2021-07-29 00:37:35 -07:00

14 lines
309 B
Bash
Executable file

#!/usr/bin/env zsh
# YES_ZSH
autosync() {
target="$1"
shift
# as a reminder not to get the argument order mixed up:
echo -E "rsyncing to $target" >&2
while inotifywait -q -e create,modify "$@"; do
\rsync -rtl "$@" "$target"
done
}
[ "${SOURCING:-0}" -gt 0 ] || autosync "$@"