In a bash script, I want to get the cursor column in a variable. It looks like using the ANSI escape code {ESC}[6n is the only way to get it, for example the fo
{ESC}[6n
You could tell read to work silently with the -s flag:
read
-s
echo -en "\E[6n" read -sdR CURPOS CURPOS=${CURPOS#*[}
And then CURPOS is equal to something like 21;3.
21;3