1

I use Arch Linux with KDE as GUI. I have recently modified my ~/.bashrc script in order to add some stuff to my user terminal.

Sometimes when I recall last terminal command and changed it, part of this command remains visible and I cannot fully delete it, but if I hit enter, nothing happens, the command is just visible, the input buffer is empty.

After hitting enter, the next line's behavior is as usual. For example:

  • I recall last command -> echo "help please"
  • I want to use echo "thanks", so I delete part of it
  • The output just keeps part of the previous command --> echo "he, for example
  • If I hit enter echo "he does not generate an error or print anything (as if this command is only in the output buffer, not a command store).
  • the next line has regular behavior.

These are the lines I added to ~/.bashrc:

alias ls='ls --color=auto'
alias ll='ls -l'
#PS1='[\u@\h \W]\$ '
PS1=$'[\A \e[0;36m\u@\h\e[m \W]\n
\e[0;36m\u2514\u2500\u2500\u2500>\e[m \$ '

Thanks for the help and Happy New Year!

terdon
  • 242,166
  • @KamilMaciorowski the question you suggest looks very relevant, but how would the answer there solve the OP's problem? The PS1 in the question works fine on my system and doesn't seem to have the issues mentioned in the suggested dupe or, at least, I haven't been able to reproduce it. – terdon Jan 01 '23 at 23:49
  • 1
    @terdon "doesn't seem to have the issues mentioned in the suggested dupe" – It does. \e[0;36m and \e[m (each appearing twice) are non-printable sequences, not enclosed in \[ and \]. – Kamil Maciorowski Jan 01 '23 at 23:56
  • 1
    Ah, yes, I had missed that, thanks @KamilMaciorowski. So, Eugenio, it looks like the solution is changing your PS1 to this: PS1=$'[\A \[\e[0;36m\]\u@\h\[\e[m\] \W]\n\[\e[0;36m\]\u2514\u2500\u2500\u2500>\[\e[m\] \$ '. – terdon Jan 02 '23 at 00:08
  • ok, thanks a lot! the problem seems solved!! again, thank you! – eugenio b Jan 02 '23 at 11:18

0 Answers0