fswatch

Bash Script - fswatch trigger bash function

余生长醉 提交于 2021-02-08 09:47:38
问题 I have a bash script where I want to trigger a method every time the filesystem is changed: #!/bin/bash function run { echo Do some magic // Do some magic } run fswatch . src | 'run' In this case I am watching the src folder. When I trigger the script via ./automater.sh the script executes the run function the first time correctly and when I then change some file, the script simply exits... 回答1: BUT then it runs in a loop.... , I also hit this, because after your ./automater.sh execution,

How to run fswatch to call a program with static arguments?

醉酒当歌 提交于 2019-12-20 10:34:32
问题 I used to use fswatch v0.0.2 like so (in this instance to run django test suit when a file changed) $>fswatch . 'python manage.py test' this works fine. I wanted to exclude some files that were causing the test to run more than once per save (Sublime text was saving a .tmp file, and I suspect .pyc files were also causing this) So I upgraded fswatch to enable the -e mode. However the way fswatch has changed which is causing me troubles - it now accepts a pipe argument like so: $>fswatch . |

Writing files in the background process

风格不统一 提交于 2019-12-14 03:56:34
问题 I am trying to create a script that will process modified/new files in a directory (which is being mirrored from a remote directory by lftp but that's another story). To keep track of the files that are modified I use fswatch . I then convert the files detected by fswatch from xml to json and store them in a separate directory. To make sure that I can stop this conversion once there are no more files to process (when the mirroring job is over) I keep track of a file that will be created by

Real-time git diff

痞子三分冷 提交于 2019-12-10 17:28:10
问题 I typically like to type up my git commit messages while looking at the git diff. I very much enjoy the output produced by this little perl add-on to git, and produces output that looks like this from git diff (this is a screenshot of git log -p but you get the idea: Because of how it highlights out the corresponding parts of the lines that have changed it is very easy to see what's changed. Just wanted to share that because it does not look like a lot of people use it, and for me it beats

How to watch file changes on Mac OSX using FSWatch?

末鹿安然 提交于 2019-12-06 23:52:37
问题 I'm trying to use fswatch to translate the following lines from a linux bash script to be able to run it on Mac OSX: inotifywait -r -m 'myfolder/' | while read MODFILE do echo "something" done Since inotifywait doesn't work on Mac OSX I want to substitute the first line for FSWatch. Although the README refers to the fswatch man page, it doesn't provide a link to it and a search around the internet doesn't get me anything. So I tried messing around a bit. I created a folder called testfswatch/