mirror of
https://github.com/notwa/rc
synced 2024-11-05 07:19:02 -08:00
18 lines
400 B
Bash
Executable file
18 lines
400 B
Bash
Executable file
#!/usr/bin/env zsh
|
|
# YES_ZSH
|
|
# NO_BASH
|
|
# NO_DASH
|
|
|
|
# TODO: portable way of dodging aliases to allow other shell support?
|
|
|
|
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 "$@"
|