I'm using a simple python.py script in Linux. I need to run a while/counter loop and would like to stop the loop immediately by using a/any terminal command. I need to run the script using Screen. Simply stopping the Screen session doesn't work - it only stops the current process in the loop and then continues with the next process. The terminal command must preferably be specific for the loop in question.
I was looking at a Try / Except loop:
x = 1
y = 100
try:
while x < y:
process x
time.sleep(10)
x = x + 1
except ?
I don't know where to start. I need help with the implementation or maybe a better way to do this.