linux命令,能组合写成一个#!bin/bash吗?ps aux |grep coremail | awk -F ' ' {'print$2'} > 1 | sed -i 's/^/kill -9 /g' 1 sed -i 's/^/kill -9 /g' 1sed -i '1i #!bin/bash' 1
问题描述:
linux命令,能组合写成一个#!bin/bash吗?
ps aux |grep coremail | awk -F ' ' {'print$2'} > 1 | sed -i 's/^/kill -9 /g' 1
sed -i 's/^/kill -9 /g' 1
sed -i '1i #!bin/bash' 1
答
#!/bin/bash
cmd=$1
if [ "$cmd" = "" ];then
echo "请输入你要结束的进程的名字!"
exit
fi
echo "#!/bin/bash" >1
chmod +x 1
ps aux | grep $cmd | grep -v grep | awk -F' ' {'print "kill -9 " $2'} >>1
/bin/bash 1
rm -rf 1