I'm working on Linux, I have executed the for loop on a Linux terminal as follows:
for i in `cat fileName.txt`
do
echo $i
vim $i
done
fileName.txt is a file contains the large no of file entries that I'm opening in vim editor one by one. Now i have to skip opening other files in between.(i.e. i have to break the for loop). Any suggestion how to get the PID of running for loop? and kill the same. Thanks in advance.
You want to kill the running job. Press CtrlZ. Bash will show something like:
[1]+ Stopped vim $i
Use that number with kill
to send the KILL
signal:
kill -9 %1
and it should be killed afterwards:
[1]+ Killed vim $i
This might also do the trick:
while true ; do killall vim ; done
You can abort this one with ^C as usual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With