Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 36572  / 2 Years ago, fri, november 18, 2022, 12:55:19

I wrote a bash script that logs keycodes in a simple file. I have put the code in a while loop because I want it to log continuosly. But if I run the bash script in the terminal, the cursor just keeps blinking suggesting that the file is indeed caught in an infinte loop. Now i want to be able to quit this loop gracefully. I don't know how. Ctrl+C won't work. I just close the terminal and force quit the process. How do i break out of the while loop as and when the user feels like quitting the program?


More From » bash

 Answers
6

If you get a blinking cursor you are probably not actually in a loop. You are probably expecting input. Try Ctrl+D. If that doesn't work then open a new terminal and ps aux | grep command where command is the name of the script you wrote and then kill the pid that is returned.


[#33094] Saturday, November 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
asketbridiculou

Total Points: 168
Total Questions: 116
Total Answers: 115

Location: Antigua and Barbuda
Member since Sat, Jan 28, 2023
1 Year ago
;