[英]how to use command results values in a table in bash shell scripting
when I run most shell commands they give results as tables 当我运行大多数shell命令时,它们以表的形式给出结果
ex 前
$lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 7610 treinetic-macbook 50u IPv6 0x49a7d04a92982f61 0t0 TCP
If I want to use one of those results how can i do that in a shell script. 如果我想使用这些结果之一,该如何在Shell脚本中执行。
ex- think that i want to use PID value of above result. 假设我想使用上述结果的PID值。
kill -9 PID
您可以-t
使lsof
仅返回PID:
kill -9 $(lsof -t -i :8080)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.