mirror of
https://github.com/notwa/rc
synced 2024-11-13 19:59:02 -08:00
19 lines
628 B
Bash
Executable file
19 lines
628 B
Bash
Executable file
#!/usr/bin/env zsh
|
|
# compat: -ash -bash -dash -hush -ksh -mksh -oksh -osh -posh -yash +zsh
|
|
|
|
# TODO: portable way of dodging aliases to allow other shell support?
|
|
# TODO: rewrite to use entr instead of inotifywait.
|
|
|
|
autosync() { ### @-
|
|
### combine `inotifywait` and `rsync`.
|
|
### this is sometimes nicer than `ssh`-ing into a server and running `vim` remotely.
|
|
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
|
|
}
|
|
|
|
[ -n "${preload+-}" ] || autosync "$@"
|