sh screen - Wait for screen to terminate
问题 I'm writing on a little script that does send a command to a running screen session. This command stops the screen but not instantly. I need to wait for it to finish in order to continue with the rest of the script. This is how I stop the screen: screen -S $SCREEN_NAME -p 0 -X stuff "`printf "stop\r"`" How could I do this? 回答1: I found an solution: You just simply check if the screen is still running and wait ( sleep ) for one second. Like this: while screen -list | grep -q $SCREEN_NAME do