Skip to content

Pause until Enter

Wait for Enter before continuing; exit 0 on EOF.

18th August 2026

pause() {
  printf "\nPress Enter to continue..."
  if ! read -r _; then
    printf "\nEOF; exiting.\n"
    exit 0
  fi
}

Caveats

Exits the whole process on EOF (for example Ctrl-D).