I have a bash script that runs a program in a loop and reads the output from a program. I want that when I hit control-c, it exits the program as well as the script.
I tried this but didn't seem to end the program.
control_c() { exit } while true ; do trap control_c SIGINT my_command | while read line ; do echo $line ... done done
Can someone show me the correct way to accomplish what I described? Thanks!
j.lee source share