Avoid beeping when setting the console title if non-ascii chars in $PWD.
authorAnselm Kruis <a.kruis@science-computing.de>
Mon, 2 Sep 2013 11:24:54 +0000 (2 13:24 +0200)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Fri, 13 Sep 2013 13:50:26 +0000 (13 14:50 +0100)
Fix for issue #128 where the prompt causes the console to beep if there are
non-ASCII characters in the path. This patch replaces all non-ASCII characters
with a question mark when expanding the prompt

Signed-off-by: Anselm Kruis <a.kruis@science-computing.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
etc/profile

index 6c68d7d..6e80b0a 100644 (file)
@@ -153,7 +153,7 @@ esac
 [ -r /git/contrib/completion/git-prompt.sh ] && . /git/contrib/completion/git-prompt.sh
 
 # non-printable characters must be enclosed inside \[ and \]
-PS1='\[\033]0;$MSYSTEM:\w\007\]' # set window title
+PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title
 PS1="$PS1"'\n'                 # new line
 PS1="$PS1"'\[\033[32m\]'       # change color
 PS1="$PS1"'\u@\h '             # user@host<space>