Bash 屏幕不断终止

Bash 屏幕不断终止,bash,gnu-screen,Bash,Gnu Screen,我试图在屏幕中运行脚本,该屏幕使用inotifywait检查正在创建的新文件,然后在出现与某些参数匹配的事件时运行脚本。由于某些原因,即使正在运行的脚本是循环的,屏幕也会不断终止 我用screen-d-m-S scriptname//path to.sh启动屏幕,脚本的循环部分如下所示 #start folder monitoring while fileevent=$(inotifywait -rq -e create $path_to_monitor); do CheckFileEvent;

我试图在屏幕中运行脚本,该屏幕使用
inotifywait
检查正在创建的新文件,然后在出现与某些参数匹配的事件时运行脚本。由于某些原因,即使正在运行的脚本是循环的,屏幕也会不断终止

我用screen-d-m-S scriptname//path to.sh启动屏幕,脚本的循环部分如下所示

#start folder monitoring
while fileevent=$(inotifywait -rq -e create $path_to_monitor); do CheckFileEvent; done

跑步循环取决于分配的结果,请尝试以下操作:

while :;do
    fileevent=$(inotifywait -rq -e create $path_to_monitor)
    CheckFileEvent
  done