This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash puzzle: Spaces, environment variables and tab completion


On Wed, 4 Dec 2002 22:01:04 -0800 (PST), James Shaw <qumqam@yahoo.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@unix.mvs.co.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]