How to kill a running for loop on linux?

linux, pid

Solution

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

Problem

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.

Original source