# Created on savesnippets.com · https://savesnippets.com/lLjnc9tEC7ekzI read -n 1 -p "Continue? (y/n) " key echo [[ "$key" == "y" ]] && echo "Continuing…" # Silent (no echo) — good for password-style entry read -s -p "Password: " pw echo echo "Got ${#pw} chars" # Read with a timeout (in seconds) if read -t 5 -n 1 -p "Press any key (5s)… " key; then echo " got $key" else echo " (timed out)" fi