summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9367c58)
Add template that prompts a user for input until a valid answer is
provided.
--- /dev/null
+#!/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