标签: bash macos tail
我有一个简单的shell脚本(在macOS和Linux上),该脚本可以启动服务,尾随日志并在退出尾巴时应关闭服务:
#!/bin/bash startmyService.sh tail -f service.log stopmyService
当我用Ctrl-C或Ctrl-Z退出tail时,整个shell脚本将停止。如何退出tail -f并让Shell脚本继续执行下一条指令?
Ctrl-C
Ctrl-Z
tail -f