BAEL-3370: First draft of menu
This commit is contained in:
parent
9818939e40
commit
18b9e796ef
|
@ -58,6 +58,7 @@ timeout_input_read(){
|
||||||
read -p "$prompt" -s -r -t 5 input
|
read -p "$prompt" -s -r -t 5 input
|
||||||
if [ -z "$input" ]; then
|
if [ -z "$input" ]; then
|
||||||
echo -e "\ntimeout occured!"
|
echo -e "\ntimeout occured!"
|
||||||
|
echo "empty -?> [$input]"
|
||||||
else
|
else
|
||||||
echo -e "\ninput word [$input]"
|
echo -e "\ninput word [$input]"
|
||||||
fi
|
fi
|
||||||
|
@ -68,4 +69,25 @@ exactly_n_read(){
|
||||||
read -p "$prompt" -N 11 -t 5 input1 input2
|
read -p "$prompt" -N 11 -t 5 input1 input2
|
||||||
echo -e "\ninput word1 [$input1]"
|
echo -e "\ninput word1 [$input1]"
|
||||||
echo "input word2 [$input2]"
|
echo "input word2 [$input2]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo "Read command samples"
|
||||||
|
options=("default_read" "custom_ifs_no_array" "prompt_read_password" "quit")
|
||||||
|
select option in "${options[@]}"
|
||||||
|
do
|
||||||
|
case $option in
|
||||||
|
"default_read")
|
||||||
|
echo "Default read"
|
||||||
|
default_read
|
||||||
|
;;
|
||||||
|
"custom_ifs_no_array")
|
||||||
|
echo "Custom IFS no array"
|
||||||
|
custom_ifs_no_array
|
||||||
|
;;
|
||||||
|
"quit")
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*) echo "Invalid option";;
|
||||||
|
esac
|
||||||
|
done
|
Loading…
Reference in New Issue