bug-bash
[Top][All Lists]
Advanced

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

[bug] Home dir in PS1 not abbreviated to tilde


From: Yongzhi Pan
Subject: [bug] Home dir in PS1 not abbreviated to tilde
Date: Mon, 12 Mar 2012 12:22:19 +0800

Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.

Upon login, home dir is displayed as tilde in PS1:
address@hidden ~$ echo $PS1
address@hidden \w$ \[\033[0m\]
address@hidden ~$ pwd
/export/home/pan/

After a cd command, which change directory to $HOME (not changed at all),
it is displayed as the complete path:
address@hidden ~$ cd
address@hidden /export/home/pan$

The reason is that my home in passwd has a trailing slash:
address@hidden /export/home/pan$ grep ^$USER: /etc/passwd
pan:x:896:1::/export/home/pan/:/bin/bash

This is tricky to find. I hope it will display tilde even if home dir entry
in passwd has one or more trailing slash.

PS: I read the source code and do not know where this is done, maybe in
y.tab.c?


reply via email to

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