style(user/bkytpldl-generic):Adjust comment
[BK-2020-03.git] / unitproc / bkt-promptLoop
... / ...
CommitLineData
1#!/bin/bash
2
3# Desc: Prompts user until valid answer given.
4
5while ! [ "$prompt_status" = "answered" ]; do
6 echo "Perform action? (y/n):" 1>&2;
7 read prompt;
8 case "$prompt" in
9 "y" | "yes")
10 echo -e "Doing stuff.";
11 prompt_status="answered";
12 ;;
13 "n" | "no")
14 echo "Doing nothing.";
15 prompt_status="answered";
16 ;;
17 *)
18 echo "WARNING:Invalid option $prompt"
19 prompt_status="";
20 ;;
21 esac
22done