From owner-freebsd-questions Tue Oct 19 12:28:22 1999 Delivered-To: freebsd-questions@freebsd.org Received: from wopr.caltech.edu (wopr.caltech.edu [131.215.240.222]) by hub.freebsd.org (Postfix) with ESMTP id CD39A17A4A for ; Tue, 19 Oct 1999 12:28:14 -0700 (PDT) (envelope-from mph@wopr.caltech.edu) Received: (from mph@localhost) by wopr.caltech.edu (8.9.3/8.9.1) id MAA34091; Tue, 19 Oct 1999 12:27:57 -0700 (PDT) (envelope-from mph) Date: Tue, 19 Oct 1999 12:27:56 -0700 From: Matthew Hunt To: patl@phoenix.volant.org Cc: Arcady Genkin , freebsd-questions@FreeBSD.ORG Subject: Re: Bash prompt (/usr/home/username instead of ~/) Message-ID: <19991019122756.A34003@wopr.caltech.edu> References: <87ln905oew.fsf@main.wgaf.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: ; from patl@phoenix.volant.org on Tue, Oct 19, 1999 at 11:51:20AM -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 * 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