首页 > 其他分享 >tput用法

tput用法

时间:2022-10-17 02:33:05浏览次数:91  
标签:current tput echo cursor line 用法 bash

1.  Clear all text on current line from a bash script

while :; do # an infinite loop just for demonstration
    echo "$RANDOM" # print your stuff here
    sleep 0.2
    tput cuu1 # move cursor up by one line
    tput el # clear the line
done

2. save and store cursor

echo "this is a tput test"
echo ""
tput sc
for((i=0,j=7; i<=7; i++,j--)); do
    ans=$((((((i % 2)) + 1))*2))
    echo $(tput cuu1; tput el; tput setaf $ans;)"show me the money $ans"$(tput sgr0)
    sleep 1
done
tput rc
echo "test done"

shell tput clear the current line

bash: clear string between two positions - Unix Stack Exchange

shell tput get current cursor position

How to get the cursor position in bash?

 

标签:current,tput,echo,cursor,line,用法,bash
From: https://www.cnblogs.com/shaohef/p/16797766.html

相关文章

  • AI 绘画高级用法 魔道书字典炼金入门
    高级用法魔道书字典炼金入门基于AUTOMATIC1111(https://github.com/AUTOMATIC1111)/stable-diffusion-webuiAttention/emphasis注意/强调使用()在提示中增加模型对内......
  • Vue中 export 和import用法
    一,importimportHelloWorldfrom'./components/HelloWorld.vue'importTheWelcomefrom'./components/TheWelcome.vue'import*asssfrom'./assets/export'imp......
  • union all和union的区别用法
    unionall和union的区别:取结果的交集,union对两个结果集进行并集操作,不包括重复行,相当于distinct,同时进行默认规则的排序;unionall:对两个结果集进行并集操作,包括重复行,即所......
  • 补:java中static的用法总结
    关于java在static中的用法,大致可以总结为以下三个模块:其一为:静态变量某些特定的数据在内存中只有一份,而且能被一个类的所有实例对象共享。可以使用类名.变量名的形式来访......
  • python中sort()函数跟sorted()函数的用法及区别
    一、描述sorted()函数是用来对某个对象进行排序操作的函数sorted()函数与sort()函数的区别是:sort只能用于列表对象(list),而sorted可以对所有可迭代对象进行排序。sort......
  • 逆向查找合并单元格中的数据,经典用法!
    Excel情报局职场联盟Excel生产挖掘分享Excel基础技能Excel爱好者大本营用1%的Excel基础搞定99%的职场问题做一个超级实用的Excel公众号Excel是门手艺玩转需要勇气数万Excel......
  • JS高级用法-清空数组
    letarr=[12,43]arr.slice(0)//克隆数组arr.splice(0)//克隆数组,意思是返回一个新的数组,arr变为[]arr.length=0//清空数组arr变为[]//也就是说,清空数......
  • Python 中isinstance的用法
    isinstance()函数用来判断一个对象是否是一个已知的类型.isinstance(object,classinfo)类似type().isinstance()与type()区别:type()不会认为子类是一种父类类型,不......
  • Session用法案例 -->实现简单购物车功能(实际项目可能不会这么使用)
    071201709091、session是在cookie的基础之上,利用cookie返回JSESSIONID(key[服务器随机生成])存在客户端实现,正真的数据存在服务端[key-value]。2、se......
  • Cookie用法案例-->自动登陆
    070201709071、cookie是浏览器保存数据的一种形式,数据由服务端产生,通过响应头(setCookie)把数据写入cookie中,浏览器接受到数据后,浏览器将服务器发来......