Bash Script - fswatch trigger bash function
问题 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,