#!/bin/sh
flag=1
pid=''
while ((flag < 100))
do
pid=`ps -ef | grep jfqqqProgress | grep -v grep | awk '{print $2}'` #the result type of this command is string
echo kill jfqqqProgress, round ${flag}
if [ "$pid" = '' ];then
echo 'not found progress...'
else
for i in ${pid[@]};do
echo found progress, pid: ${i}, now killing it!
kill -9 $i
done;
fi
let flag+=1
sleep 1
done
shell脚本杀死进程循环100次,每次间隔1s
于 2021-06-24 17:41:08 首次发布
这是一个自动化脚本,用于循环查找并杀死名为'jfqqqProgress'的进程。它通过`ps-ef`命令获取进程信息,使用`grep`过滤,并用`awk`打印进程ID。如果找不到进程,则输出'not found progress...';否则,它会逐个杀死找到的进程,并显示相关信息。
1万+

被折叠的 条评论
为什么被折叠?



