Proper way to use a trap to exit a shell-script in ZSH?
问题 I'm having trouble getting a trap function in a Zshell-script to work without exiting the shell. I have a simple countdown timer that I want to be able to interrupt using ^C, and when I do I want the trap to change the cursor status in the terminal. My syntax is: #!/bin/zsh trap 'tput cnorm; exit' INT TERM I've also tried: trap 'tput cnorm; kill -9 $$' INT TERM Both interrupts exit the shell entirely. How do I only exit the script and return to the command line? Any guidance will be most