What you need to do it find the process ID (PID) of the process which is stuck in a loop, and then use the kill program to send it a signal which tells it to terminate.
Exactly how to identify it will depend on how the script is run.
If the script is mad executable and called like a binary (i.e. the script is invoked directly by using the name of the script file), it will be in the process list under the name of the file. For example, say the script is called "my_script", you can find it like this:
Code:
ps aux |grep my_script
You should see output something like this:
Code:
matthew 1080 0.2 0.2 4332 1508 pts/0 S 13:10 0:00 /bin/bash ./my_script
matthew 1087 0.0 0.1 2988 776 pts/0 S+ 13:10 0:00 grep my_script
The second column is the process ID. In my example it is 1080.
To kill the script you use the kill program with the process ID you found, like this:
This asks a process to terminate. It is possible that the program will refuse to terminate, although it's not usually the case. If it does refuse to terminate, you can tell it in no uncertain terms like this:
This signal cannot be ignored, and will kill the program immediately. Some programs which are waiting on some blocking kernel resource might still not die for a little while, but this is rare.