Anyone with a complex .bashrc file has probably encountered this. If you type anything while Bash is loading, the characters you typed are printed both to the left and to the right of the prompt once it has loaded.
For example...
Steps to reproduce
- Add
sleep 5
to the bottom of your .bashrc file - Close and reopen your terminal emulator
- After the terminal loads, but before Bash has finished loading, type asdf
Actual result
asdfuser@hostname$ asdf
Desired result
user@hostname$ asdf
Is there any way to clear the text to the left of the prompt, or prevent it from ever showing up to begin with, without doing a clear or a reset?
(For whatever it's worth, I'm asking because I would like to programatically create a tmux session which prints certain text to the prompt without executing it. This keeps happening because tmux prints the text before Bash has finished loading. But this happens even outside of tmux like in the Steps to reproduce above, so I'm not sure how relevant my use of tmux is to this question.)