Hi,
I am writing a menu driven Korn script where I am getting some input from the users (host details, like Hostname, HBA WWN, Devices etc...). I face a challenge when the number of input lines goes past my window size. For this reason, I am planning to use a part of the screen for user input, say from Row 30-40 with "tput cup 30 20 ". This way, I can get the user input for one host at a time and display only important information. Now, how do I clear the screen only from Row 30 to 40 for the next entry?
I tried something like tput cup 30 20 clear, but that doesn't work. I anyone has a script or know a way to do this, please share your knowledge. Your help is really appreciated.
You can use tput el
to clear from current position to end of line.
So to define $CLEAR_HOST to clear a block from 30,10 to 40,10 you could do:
CL=$(tput el)
L=30
while [ $L -le 40 ]
do
CLEAR_HOST="$CLEAR_HOST$(tput cup $L 10)$CL"
let L=L+1
done
The just do printf "%s" $CLEAR_HOST
whenever you want to clear the HOSt entry area.
Thanks for clue, Chubler ..... "tput ed" is what I was looking for.