Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Oct 1999 12:27:56 -0700
From:      Matthew Hunt <mph@astro.caltech.edu>
To:        patl@phoenix.volant.org
Cc:        Arcady Genkin <a.genkin@utoronto.ca>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Bash prompt (/usr/home/username instead of ~/)
Message-ID:  <19991019122756.A34003@wopr.caltech.edu>
In-Reply-To: <ML-3.4.940359080.6212.patl@asimov>; from patl@phoenix.volant.org on Tue, Oct 19, 1999 at 11:51:20AM -0700
References:  <87ln905oew.fsf@main.wgaf.net> <ML-3.4.940359080.6212.patl@asimov>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 19, 1999 at 11:51:20AM -0700, patl@phoenix.volant.org wrote:

> As I recall, the goal was to get the initial path components to show
> up as '~' when appropriate in the prompt; and the 'problem' was that
> it didn't seem to take effect until after the first 'cd' after setting
> PS1.  The suggestion was to put a 'cd' after the 'PS1=...' in the .bashrc.
> 
> My point is that you might not be in your home directory when bash is
> started; and that changing the current directory is likely to be an 
> undesired side-effect.  Using 'cd .' should have no side-effects beyond
> triggering the change in the prompt.

But for me, "cd ." doesn't make the prompt work!  I assume that I
observe the same problem that the original author does:

freefall:/d/users/mph$ pwd
/d/users/mph
freefall:~$ echo $HOME
/home/mph
freefall:/d/users/mph$ cd .
freefall:/d/users/mph$ cd
freefall:~$ pwd
/home/mph

The problem is that bash's initial idea of where you are (from getcwd(3)
when it starts?) doesn't match $HOME.  When you "cd" (not "cd ."), it
changes directory to $HOME, and becomes happy.

-- 
Matthew Hunt <mph@astro.caltech.edu> * Inertia is a property
http://www.pobox.com/~mph/           * of matter.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991019122756.A34003>