ESC=$'\033'
CSI="${ESC}["

# // ESC [ Pn J - ED - Erase in Display
echo -n "${CSI}2J"	# // Clear all

# // Esc [ Pn ; Pn r - set top and bottom margins
echo -n "${CSI}4;7r"

# // ESC [ Pn ; H - Cursor Position
echo -n "${CSI}8;1H"	# below bottom margin


# // ESC [ Pn A - Cursor Up
echo -n "L1${CSI}6AL2"	# stop at top margin

sleep 1; echo text1
sleep 1; echo text2
sleep 1; echo text3
sleep 2; echo text4

#expected screen:
#<empty line>
#<empty line>
#<empty line>
#text2
#text3
#text4
#<PS1 prompt>
#L1
#<... empty lines ...>
