Bash puzzle: Spaces, environment variables and tab completion

Ehud Karni ehud@unix.mvs.co.il
Thu Dec 5 07:22:00 GMT 2002


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/



More information about the Cygwin mailing list