I know that
tput sc saves the current cursor position and
tput rc restores it exactly where
tput sc was called. The problem is that every time
tput sc is called, it overwrites the previous saved position.
Is there a way to save more positions, e.g.
tput sc pos1 and
tput sc pos2 which can be restored with, say,
tput rc pos1 and
tput rc pos2 respectively? (The solution need not make use of
tput, I mentioned it because it's the only command I know that handles cursor position)
If not, is there a way to at least save the cursor position locally in a function, so that if a function uses
tput sc and then calls another function that runs again
tput sc, then each function restores its own saved cursor position when invoking
Thanks in advance.