简体   繁体   English

在shell脚本中单行执行grep并杀死pid

[英]Execute grep and kill pid in single line in shell script

我需要在 shell 脚本的同一行中执行 grep pid 和 kill -9 命令,以便在 expect 命令中传递它,但无法使其工作。

Use pkill PATTERN :使用pkill PATTERN

pkill 'jvm'

pkill will send the specified signal (by default SIGTERM) to each process instead of listing them on stdout. pkill 将向每个进程发送指定的信号(默认为 SIGTERM),而不是在 stdout 上列出它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM