#!/bin/bash # Sat Apr 24 23:25:04 EDT 2004 # Requires ANSI terminal emulation, and tput # It's experimental, not not guaranteed to work everywhere # Copyright 2004, Chris F.A. Johnson # Released under the terms of the GNU General Public License ## special characters NL=$'\n' CR=$'\r' TAB=$'\t' ESC=$'\e' ## screen codes CSI=$ESC[ NA=${CSI}0m wbl=$'\e[0;1;44;37m' stty=`stty -F /dev/tty -g` sleepx() { ## 10ths of a second local delay=${1:-1} stty -icanon time ${delay#.} min 0 dd bs=1 count=1 >/dev/null 2>&1 } spread() { local string=" $* " local n=0 tput civis local l=${#string} x=$(( COLUMNS / 2 )) while [ $(( n += 1 )) ] do s="${string:0:n}${string: -$n}" [ ${#s} -gt ${l} ] && break printat 3 $(( $x - $n )) "$wbl$s$NA" sleepx 1 done printat 3 $(( $x - $n )) "$wbl$string$NA" printat $(( $LINES - 1 )) 1 } printat() { ## USAGE: printat row column string [ $# -lt 2 ] && return 1 local y=${1:?} local x=${2:?} shift 2 printf "\e[%d;%dH%b" ${y#-} ${x#-} "$*" } clear cat <