如何从 shell 脚本中的命令输出中提取列值
How to extract a column value from a command output in shell script
我正在尝试编写一个 shell 脚本,我想在其中终止 fuser
命令给出的进程列表。
给出了fuser
的输出。我想杀死列出的 pids
kill -9 157909 1504107 1504111 1504112 2690311 3206490
我该怎么做?
ps -u beadm | awk '{print $2}' |读行时;做 kill -9 $line;完成
-k, --kill
Kill processes accessing the file. Unless changed with -SIGNAL,
SIGKILL is sent. An fuser process never kills itself, but may
kill other fuser processes. The effective user ID of the
process executing fuser is set to its real user ID before
attempting to kill.
fuser -k
会做的。
我正在尝试编写一个 shell 脚本,我想在其中终止 fuser
命令给出的进程列表。
给出了fuser
的输出。我想杀死列出的 pids
kill -9 157909 1504107 1504111 1504112 2690311 3206490
我该怎么做?
ps -u beadm | awk '{print $2}' |读行时;做 kill -9 $line;完成
-k, --kill Kill processes accessing the file. Unless changed with -SIGNAL, SIGKILL is sent. An fuser process never kills itself, but may kill other fuser processes. The effective user ID of the process executing fuser is set to its real user ID before attempting to kill.
fuser -k
会做的。