Unix 管道杀戮命令

Unix 管道杀戮命令,unix,kill,Unix,Kill,我正在Terminal中尝试这一点: /tmp ps x | grep -m1 firefox | cut -d' ' -f1 | kill -KILL kill: not enough arguments 我怎样才能通过管道杀死pid 我试过了,没用 /tmp ps x | grep -m1 firefox | kill -KILL $(cut -d' ' -f1) cut: -: Input/output error kill: not enough arguments 您可以

我正在Terminal中尝试这一点:

/tmp ps x | grep -m1 firefox | cut -d' ' -f1 | kill -KILL    
kill: not enough arguments
我怎样才能通过管道杀死pid

我试过了,没用

 /tmp ps x | grep -m1 firefox | kill -KILL $(cut -d' ' -f1)
cut: -: Input/output error
kill: not enough arguments

您可以使用xargs。这将读取command1的输出,并将其用作运行command2的参数:

command1 | xargs command2
就你而言

ps x | grep -m1 firefox | cut -d' ' -f1 | xargs kill -KILL