Skip to content

Instantly share code, notes, and snippets.

View p3lim's full-sized avatar

Adrian L Lange p3lim

  • Norsk Helsenett SF / HelseCERT
  • Norway
View GitHub Profile
@p3lim
p3lim / ask.sh
Created October 20, 2016 19:31
Bash: General-purpose Yes/No prompt function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
local prompt default REPLY
while true; do