++++
On 6/28/25 19:04, Jeffrey Walton wrote:
On Sat, Jun 28, 2025 at 6:29 PM Eben King <e...@gmx.us> wrote:
A while back I wrote a script to take the output of dd and make a graph
of the transfer rate. It worked, but since it scrolls up I wasn't happy
with it.
In a bash script, I'm trying to use tput commands to delete column 1
(tput cup $row 1 && tput el1), scoot the rest of the line left, then
draw along the right edge (echo -n). Step 2 is proving problematic, as
in I don't know how to do it. Is there another way? Thanks.
Provide your script.
ok.
#! /bin/bash
word=scroll
columns=$(tput cols)
lines=$(tput lines)
wordlength=${#word}
sleeptime=1
character=0
while : ; do
row=1
# go to column 2
tput cup $row 2
# clear from here to beginning of line -- this does not scoot the rest
of the line over
tput el1
# position cursor at next-to-last column
tput cup $row $((columns - 1))
# add one character
echo -n ${word:$character:1}
character=$(( (character + 1) % wordlength ))
# wait a bit
sleep $sleeptime
done