I came across with code like this:

function cursorBack() {
   echo -en "\033[$1D"
tput civis 
cursorBack 1

What does the number do?

  • 1
    What does this letter do?, I ask you. Can you find out to which letter I refer?
    – Quasímodo
    Apr 6, 2021 at 1:17
  • 1
  • @Quasímodo what letter? I support your fight against the malicious cookie banner with embedded google code
    – john doe
    Apr 6, 2021 at 1:19
  • @johndoe My point exactly. There are multiple numbers in the function, how can we know which one the asker is asking about? Thanks for the support by the way (I really do not know about Google though).
    – Quasímodo
    Apr 6, 2021 at 1:21
  • @Quasímodo Which letter? I'm not your mom so I can't read your mind. Can you find out which mom I refer?
    – Lunartist
    Apr 6, 2021 at 1:34

1 Answer 1


It's an argument to the function: note the $1 part in the echo string: that is the first argument being used by the bash function. Try running the function with varying arguments, e.g. cursorBack 5, or even cursorBack foo, to see what happens.

Note that the first part of the echo command is an ANSI escape, followed by the function argument (a number), followed by the letter D. That letter means back (think delete, without removing the character), so it moves it n positions back (1 position in your example).

Logically, using foo as an argument will thus not do what it's supposed to do: the arguments in this specific case should only be (integer) numbers.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.