# try multiple methods to read from terminal
if [ -t 0 ]; then
  # standard input is connected to terminal
  read -r reply
elif [ -r /dev/tty ]; then
  # fallback to direct TTY access
  read -r reply </dev/tty
else
  # non-interactive session
  echo ""
  echo "Non-interactive session detected."
  return 1
fi
