#!/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 首次发布