动态刷新终端窗口

#!/bin/sh
#author:furtherchan

#set -x

draw()
{
tput clear
P=`pwd`
#L=`tput lines`
#C=`tput cols`
STRING_A='top-left'
STRING_B='top-right'
STRING_C='bottom-left'
STRING_D='bottom-right'
LEN_P=`expr length $P / 2`
LEN_A=`expr length $STRING_A`
LEN_B=`expr length $STRING_B`
LEN_C=`expr length $STRING_C`
LEN_D=`expr length $STRING_D`
tput cup 0 0
echo -n "$STRING_A"
tput cup 0 `expr $C - $LEN_B`
echo -n "$STRING_B"
tput cup $L 0
echo -n "$STRING_C"
tput cup $L `expr $C - $LEN_D`
echo -n "$STRING_D"
tput cup `expr $L / 2` `expr $C / 2 - $LEN_P`
#read i
}
L=`tput lines`
C=`tput cols`

draw

while true
do
 if [ $L = `tput lines` -a $C = `tput cols` ]
 then
  continue
 else
  unset L
  unset C
  L=`tput lines`
  C=`tput cols`
  draw
  sleep 0.3
 fi
done

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值