X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/849106f7246e47bc077d7f3b8228cec717a8e63d..26f0533782d8c57fb95b8df4f55057edcbf17703:/unitproc/bkt-promptLoop diff --git a/unitproc/bkt-promptLoop b/unitproc/bkt-promptLoop new file mode 100644 index 0000000..b476439 --- /dev/null +++ b/unitproc/bkt-promptLoop @@ -0,0 +1,22 @@ +#!/bin/bash + +# Desc: Prompts user until valid answer given. + +while ! [ "$prompt_status" = "answered" ]; do + echo "Perform action? (y/n):" 1>&2; + read prompt; + case "$prompt" in + "y" | "yes") + echo -e "Doing stuff."; + prompt_status="answered"; + ;; + "n" | "no") + echo "Doing nothing."; + prompt_status="answered"; + ;; + *) + echo "WARNING:Invalid option $prompt" + prompt_status=""; + ;; + esac +done