我正在使用fswatch和rsync在Mac和ubuntu服务器之间自动同步目录。 外壳就像
/Users/david/Documents/code/shell/fswatch_rsync.sh:
#!/bin/bash
sudo fswatch -o /Users/david/Documents/code/python/ | xargs -n1 /Users/david/Documents/code/shell/rsync_shell.sh
/Users/david/Documents/code/shell/rsync_shell.sh:
sudo rsync -vzrp --delete /Users/david/Documents/code/python/ --password-file=/etc/rsyncd.pass -e "ssh -i /Users/david/.ssh/id_rsa -p 22" 192.168.0.109::python
但是,当我在终端中运行bash /Users/david/Documents/code/shell/fswatch_rsync.sh
并更改/Users/david/Documents/code/python/
中的文件时,它会响应:
xargs: /Users/david/Documents/code/shell/rsync_shell.sh: No such file or directory
终端中的。