倒数的用法_shell脚本
工作环境:Red Hat Enterprise Linux Server release 6.5 (Santiago) 、 bash
#!/bin/bash
#
xingming=(`cat name.txt`)
echo "共有${#xingming[@]}位成员:${xingming[@]}"
echo -n "让我们一起倒数:"
#sleep 1
#echo -n "3 "
#sleep 1
#echo -n "2 "
#sleep 1
#echo "1 "
tput sc
for i in `seq 10 -1 1`
do
tput rc
sleep 1
echo -n $i
tput ed
done
echo -e "\n这次选出的成员是:${xingming[$[ $RANDOM % ${#xingming[@]} ]]}"
注释:tput sc ---- 保存当前光标
tput rc ---- 恢复到保存光标的位置
tput ed ---- 删除光标到行尾的字符
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。