# NOTE: this script assumes that the variable "$LINES" holds the number # of lines for the current terminal, and "$COLUMNS" the number of columns. # May require you to do # $ export LINES COLUMNS # before running. DO_EL=false if [ "$#" -gt 0 -a "$1" = "-e" ] then DO_EL=true fi init() { clear echo foo echo bar echo baz tput csr 0 $((LINES-2)) } bar() { tput cup $((LINES-1)) 0 $DO_EL && tput el tput smso printf "%-${COLUMNS}s" "0 $1" tput cr tput cuu1 tput rmso } spit() { printf '%b' "$1" } finish() { tput csr 0 $((LINES-1)) tput cup $((LINES-1)) 0 tput cr echo } #################### init for word in foo bar do bar x bar x spit "\nprompt\$ $word" tput cr bar "$word" echo sleep 1 bar x bar x spit 'prompt$ ' sleep 1 done bar x bar x finish