delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/05/10:22:11

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 5 Dec 2002 17:20:03 +0200
Message-Id: <200212051520.gB5FK3CJ025737@beta.mvs.co.il>
X-Authentication-Warning: beta.mvs.co.il: ehud set sender to ehud AT unix DOT mvs DOT co DOT il using -f
From: "Ehud Karni" <ehud AT unix DOT mvs DOT co DOT il>
To: "James Shaw" <qumqam AT yahoo DOT com>
Cc: "Gary R. Van Sickle" <g DOT r DOT vansickle AT worldnet DOT att DOT net>,
" Unix on M$Win" <cygwin AT cygwin DOT com>
Subject: Re: Bash puzzle: Spaces, environment variables and tab completion
In-reply-to: <20021205060104.39630.qmail@web13602.mail.yahoo.com> (message
from James Shaw on Wed, 4 Dec 2002 22:01:04 -0800 (PST))
Organization: Mivtach-Simon Insurance agencies
Reply-to: ehud AT unix DOT mvs DOT co DOT il
References: <20021205060104 DOT 39630 DOT qmail AT web13602 DOT mail DOT yahoo DOT com>
MIME-Version: 1.0

On Wed, 4 Dec 2002 22:01:04 -0800 (PST), James Shaw <qumqam AT yahoo DOT com> wrote:
> 
> One minus with this 'cheat' is that I don't get
> the 'real' name of the path.  E.g. If I cd ~/pf,
> bash (correctly) thinks that I'm in /home/jhs/pf,
> but it would be nice to use the long name.  If it
> was a hard link, neither link would be the "real"
> name, but with a symlink, there is some sense of
> "real" and "virtual".  So, if anyone has a fix for
> this minor glitch, I'd appreciate comments.

You can create a function to achieve your desire:

cd ()
{
    builtin cd "$1"
    builtin cd `pwd -P`
}

To test it interactively, you have to do the definition like this
    function cd () { builtin cd $1 ; builtin cd `pwd -P` ; }

Now, whenever you'll cd to a directory it will translate the full
directory path to its real (cygwin's) path without any symlinks.

Note. This will work with the symlink work around, NOT with the
mount one (because mount is new REAL name).

Note to Gary - this is the bash/UNIX way, you don't have to use
cygwin's unique tools (like cygpath).

Ehud.


-- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud AT unix DOT mvs DOT co DOT il                  Better  Safe  Than  Sorry

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019