title: How to get the cursor position in bash?
body: <p>In a bash script, I want to get the cursor column in a variable. It looks like using the ANSI escape code <code>{ESC}[6n</code> is the only way to get it, for example the following way:</p>
  
  <pre><code># Query the cursor position
  echo -en '\033[6n'
  
  # Read it to a variable
  read -d R CURCOL
  
  # Extract the column from the variable
  CURCOL="${CURCOL##*;}"
  
  # We have the column in the variable
  echo $CURCOL
  </code></pre>
  
  <p>Unfortunately, this prints characters to the standard output and I want to do it silently. Besides, this is not very portable...</p>
  
  <p>Is there a pure-bash way to achieve this ?</p>