【发布时间】:2016-11-29 11:04:46
【问题描述】:
我试着跑了
$ (while true; do cat some_small_file ; sleep 1; done) | some_script
测试some_script,但some_script不在我的$PATH中,所以打印出来
some_script command not found
奇怪的是Bash 没有返回,而Ctrl-C 什么也不做。
我什至尝试用
杀死sleep
ps -u maxb | grep sleep | cut -f1 -d " " | xargs kill -9
在另一个终端中,但这当然只是继续下一个循环迭代。
是否可以让Bash 终止该命令?
【问题讨论】:
-
顺便说一句,请考虑使用
pkill而不是ps | grep | xargs kill。
标签: linux bash ubuntu ubuntu-14.04