您的位置:首页 > 运维架构 > Shell

shell tput 用法

2016-07-12 15:56 302 查看
tput 是用于终端在显示的时候增强用户体验效果的一个命令, 利用tput可以是shell脚本更加完美. tput可以使你的黑布垃圾的终端重现活力.



脚本代码如下:

#!/bin/bash

echo -n Count:

tput sc   

count=0

while true;

do

    if [ $count -lt 40 ];

    then

        let count++;

        sleep 1

        tput rc

        tput ed

        echo -n $count;

    else exit 0;

    fi

done

这里 

tput sc   清空屏幕

tput rc  恢复光标最后保存的位置 

tput ed 清空光标位置到设备尾部的数据
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 脚本 shell tput