#!/usr/bin/env bash
declare uname
declare -i cnt=0
declare -a vNames
echo "Hello there!"
echo -e "If you feel like you don't wanna talk to me anymore, just hit the \"Enter\" key."
uname="test"
while [[ ! -z "${uname}" ]];
do
read -p "What's your name? " uname
if [[ ! -z "${uname}" ]]; then
vNames[++cnt]="${uname}"
echo "Nice to meet you, ${vNames[${cnt}]}!"
else
echo "You want to no longer talk to me. Well, good riddance to bad rubbish!"
fi
done
echo -n "I've gotten to know "
case ${#vNames[@]} in
0)
echo -n "nobody"
;;
1)
echo -n "only one person"
;;
*)
echo -n "${#vNames[@]} persons"
;;
esac
echo " until now."
Response:
text/plain