account.sh
#!/bin/bash
i=0
while :
do
read -p "Please input account,and end to input over:" key
if [ $key == "over" ];then
break
else
name[$i]=$key
let i++
fi
done
echo "The count of account:" ${#name[*]}
echo ${name[*]}
验证:
[root@logstash ~]# sh account.sh
Please input account,and end to input over:aa
Please input account,and end to input over:bb
Please input account,and end to input over:cc
Please input account,and end to input over:over
The count of account: 3
aa bb cc
[root@logstash ~]#