Bash prompt wrap broken when path has unicode (Greek) characters
2
votes
1
answer
538
views
When a path is too long to fit on the terminal and it wraps, the following prompt is broken and you can't see properly what is typed. See screenshot below:
These are the contents of

.bashrc
that set the PS1
, which is the default provided by Ubuntu.
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
The value of $PS1
is
echo "$PS1"
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
Is there any way to fix it?
I have seen several other similar questions, and the proposed solution is to enclose the offending part in \[ \]
, or to set checkwinsize
, but neither worked in my case.
If anyone wants to test with the path, it is the folowing:
/home/dimitriv/Dropbox/personal/kastoria/2018-2019/προγραμματισμός στο διαδίκτυο/newslides
Asked by user000001
(3795 rep)
Nov 4, 2018, 01:33 PM
Last activity: Nov 4, 2018, 02:42 PM
Last activity: Nov 4, 2018, 02:42 PM