Skip to main content
edited tags
Link
Kusalananda
  • 356.2k
  • 42
  • 737
  • 1.1k
Source Link

How can I set a bash script to wait for user input (not exit) on error?

I know that set -e tells bash to exit the script on error. The problem is that I have to address the error, then delete all previous steps from the script while maintaining any variables before executing it again to continue. Is there a way to have the script simply wait for user input read -p "Continue? " on error? If not, is there anything similar? I want the script to stop on error, then continue again when I'm ready.