当我使用 inotifywait 然后在 while 循环中读取时,某些东西会中断。我从来没有收到脚本刚刚中断的输入。这是一个例子:
#!/bin/bash
scriptDir=$(pwd)
get_input() {
read userInput
echo $userInput echod
}
inotifywait -m -e modify,create,delete $scriptDir | while read alterationDetails
do
echo "something changed"
get_input
done
理想情况下,我希望能够调用另一个脚本,而不是“get_input”,该脚本在那个while循环中接受输入。例如:
eval "node inputCatcher.js"