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

> What I want to do is define an environment
> variable so I can easily cd or ls.  E.g.
> % PF="/cygdrive/c/Program Files"
> % cd $PF
> % ls $PF/Games
> % ls $PF/G<tab completion!>
> The above is close, I can
> % cd "$PF"; ls "$PF"/Games; and even
> ls "$PF"/G<tab> however, the quotes are clunky.

That's the bash way. You can get omit the enclosing quotes if you
change the IFS environment variable like this IFS="".
Note that this may harm execution of your commands/scripts. Read
the bash man page for more information.

My (bypass) solution to your problem is to make a symlink to the
desired directory without spaces in it and use that file name.
e.g. ln -s "/cygdrive/c/Program Files" ~/PF

The advantage of this "bypass" is that you can use the symlink in
scripts without defining the environment variable for each one.


 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  FAX:  1-815-5509341  / \                  Better  Safe  Than  Sorry

Unsubscribe info:
Bug reporting:

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