how to continue run script after tail -f command
问题 I have the following script: tail -f nohup.out echo 5 When I press Ctrl + C on tail -f , the script stops running: the 5 is not printed. How can I run the command echo 5 after I stop the tail command? 回答1: Ctrl + C sends the SIGINT signal to all the processes in the foreground process group. While tail is running, the process group consists of the tail process and the shell running the script. Use the trap builtin to override the default behavior of the signal. trap " " INT tail -f nohup.out