I am trying to pipe the output of fswatch to several commands in a shell script with following technique:
$ fswatch -0 [opts] [paths] | xargs -0 -n 1 -I {} [command]
Instead of [command] I put the shell script path. Here is my command line:
fswatch -0 -Ie ".*\.*$" -i ".*\.mp4$" ~/Desktop/encoding\ tests | xargs -0 -n 1 -I {} ~/Desktop/s3cmd.sh
The script is following:
#!/bin/sh
terminal-notifier -message "s3cmd Upload {}" ;
s3cmd sync --acl-public -m video/mp4 --add-header=Cache-Control:public,max-age=2052000 {} s3://saltanat-test/ &&
terminal-notifier -message "s3cmd Upload of {} done"
Sorry I am not experienced with shell scripting. How can I pipe the the fswatch output into the script?
Thank you.