bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

\W and \w doesn't substitute $HOME for ~ properly


From: carl
Subject: \W and \w doesn't substitute $HOME for ~ properly
Date: 30 Sep 2006 14:23:56 -0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=k8 -O2 -pipe
uname output: Linux chicago 2.6.17-gentoo-r8 #1 PREEMPT Fri Sep 15 12:15:25 
CEST 2006 x86_64 AMD Turion(tm) 64 Mobile Technology ML-30 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 3.1
Patch Level: 17
Release Status: release

Description:
        If a user has it's home directory specified with a trailing
        slash, such as /home/johndoe/, instead of /home/johndoe, in
        /etc/passwd, prompting doesn't work properly.

        If PS1, and perhaps other prompts, has the \w or the \W
        which should be substituted with a tilde while the user is
        in his/her home directory, it isn't. Instead it shows
        "johndoe" or equivalent.

Repeat-By:
        export PS1='\[\033[01;35m\] \W \[\033[0;35m\]\$ \[\033[00m\]'
        and set your home directory to whatever it already is, but
        with a trailing slash.

Fix:
        Since there is no definite practice to wether a directory
        should be specified with or without trailing slash when
        the directory itself is to be specified, best practice should
        be to interpret both as the directory.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]