Sample Header Ad - 728x90

How to exit a bash loop by keyboard input?

6 votes
2 answers
7547 views
I have a bash lopp as #!/bin/bash for (( c=0; c<=1000000; c++ )) do SOME STUFF HERE done I interrupt the long loop by a keyboard input like Ctrl+C but Ctrl+C simply terminates the script. I am looking for an alternative to continue the current cycle and break the loop after finishing the running STUFF in the current cycle.
Asked by Googlebot (2009 rep)
Apr 27, 2017, 10:25 PM
Last activity: Jul 26, 2024, 02:12 PM