先貼一個剛剛碰到的腳本文件,學習sleep時碰到的,然後又去google了一下tput~
#!/bin/bash
#Filename:sleep.sh
echo -n Count:
tput sc //保存光標位置
count=0;
while true;
do
if [ $count -lt 10 ];
then let count++;
sleep 1;
tput rc //恢復光標位置到最後保存的位置
tput ed //清楚從當前光標到設備末尾的數據
echo -n $count;
else exit 0;
fi
done
另外貼一下tput命令解析的地址:http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html
也可以man tput試一下啊~