How can I set the cursor to the beginning of line in a bash script. It should have the same behavior as pressing Ctrl-a.
I tried something like this echo -e "\e[H"
but it didn't work.
Here is what I'm trying to do. Let's say I have a command that I want to perform an action on it (doesn't matter what) before executing it. So I associated a Key (using bind -x ) to a function that will perform that action. However, before executing that action, I need to place the cursor to the beginning of that command (as if pressed Ctrl-a)