|
From: | Roman Rakus |
Subject: | Re: How to show path with backslash '\' in it in the prompt? |
Date: | Wed, 21 Jul 2010 13:55:59 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 |
On 07/11/2010 05:07 AM, Chet Ramey wrote:
On 7/10/10 11:00 PM, Peng Yu wrote:On Sat, Jul 10, 2010 at 9:52 PM, Chet Ramey<chet.ramey@case.edu> wrote:On 7/10/10 9:57 PM, Peng Yu wrote:Hi, I have a directory named '\E' (two letters, rather than a single special character). I have the following $PS1 variable. $ echo $PS1 ${debian_chroot:+($debian_chroot)}\u@\h:\w\$ When my current directory is '\E', the prompt shows a special character (I think that it should be the special character '\E'). I'm wondering if there is a way to change $PS1 to show two characters '\' and 'E'.I don't get this behavior with bash-4.1. It may be PROMPT_COMMAND that is messing up your display.No. I don't think that it is because of PROMPT_COMMAND. I set PROMPT_COMMAND to the following command. But the prompt doens't change. It only print an additional line whenever I run a command. export PROMPT_COMMAND=echoOK. I still can't reproduce it with bash-4.1.
I can reproduce it. [rrakus@dhcp-lab-170 tmp]$ mkdir '\E' [rrakus@dhcp-lab-170 tmp]$ cd \\E/ ]0;rrakus@dhcp-lab-170:~/tmp/rakus@dhcp-lab-170 \E]$ ]0;rrakus@dhcp-lab-170:~/tmp/rakus@dhcp-lab-170 \E]$ set -x ++ echo -ne '\033]0;rrakus@dhcp-lab-170:~/tmp/\E' [rrakus@dhcp-lab-170 \E]$ ]0;rrakus@dhcp-lab-170:~/tmp/rakus@dhcp-lab-170 \E]$ echo $BASH_VERSION 4.1.7(1)-releaseTried with gnome-terminal (gnome-terminal-2.30.1-1.fc13.x86_64) - reproducable
with xterm (xterm-261-2.fc13.x86_64) - not reproducable echo $PS1 [\u@\h \W]\$ echo $PROMPT_COMMAND echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007" RR
[Prev in Thread] | Current Thread | [Next in Thread] |