delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/04/04:37:14

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: Wed, 4 Dec 2002 11:36:51 +0200
Message-Id: <200212040936.gB49apif006548@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: qumqam AT yahoo DOT com
Cc: cygwin AT cygwin DOT com
Subject: Re: Bash puzzle: Spaces, environment variables and tab completion
In-reply-to: <20021204060952.8081.qmail@web13602.mail.yahoo.com> (message from
James Shaw on Tue, 3 Dec 2002 22:09:52 -0800 (PST))
Organization: Mivtach-Simon Insurance agencies
Reply-to: ehud AT unix DOT mvs DOT co DOT il
References: <20021204060952 DOT 8081 DOT qmail AT web13602 DOT mail DOT yahoo DOT com>
MIME-Version: 1.0

> 
> 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.


-- 
 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