This is the mail archive of the 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

Hi all,

Thanks to everyone for the advice.

The first posts of advice were that it wasn't
possible to do within the bash quoting mechanism:

"You're swimming upstream. Don't do that. Use the
system in accordance with its design."

I agree that I felt like I was swimming upstream.
Hence my post.  I do find it a little odd, because
if I type into the command line:
% cd /cygdrive/c/Program\ Files/G<Tab>
it will work.  But I seem to have no means to
define an alias/macro/variable to exactly equal
'/cygdrive/c/Program\ Files' _and_ be expanded
before (and therefore available) to tab

Although I appreciate Gary's encouragement, going
around bash instead of struggling with it, does
seem the better solution.  There were several
variations on the same theme on this bypass
solution.  Thanks to Ehud, Michael and Igor.
Basically either symbolically link or mount a (non
spaced) file to the problem path.  Then I can
define an environment variable to that link/mount.

I've been playing around with these suggestions
today and this solution does work!  Puzzle solved.
(Or at least worked around.)

Some notes:
Contrary to my expectations (and Randall's post),
ls -L isn't needed.  I can ls ~/pf, and it will
deref the symlink and list the contents of
c:/Program Files.  And ls isn't aliased to ls -L.
Any thoughts on why this is?

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.

This isn't that important for me since the main
reason I have these aliases is to pop open windows
explorer with the path in question.  I find it
very handy when in a cygwin shell to open an
'explorer' window in my current directory, so I
wrote a little Perl script to cygpath a directory
and call explorer.  This is especially useful to
copy from one open cygshell to another or to throw
stuff in the Recycle Bin (rather than rm, if I'm
feeling skittish).  I find this command useful to
navagate my windows world via cygwin and if
there's any interest, I'd be happy to post the

Finally, I didn't try mount, since symlinking
worked.  I think that I've read that for cygwin,
mount is faster (perhaps the mount table is in
memory while the sym link is on disk?), but I sort
of feel that mount is a superuser command and,
even though I'm the only user, I like to stick to
non-superuser solutions if available.

Again, thanks to everyone who helped.


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

Unsubscribe info:
Bug reporting:

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