X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain; 	charset="us-ascii"
Subject: RE: cygpath -u  doesn't seem to convert spaces properly
Date: Wed, 26 Sep 2007 08:48:36 -0400
Message-ID: <4C89134832705D4D85A6CD2EBF38AE0F0131EF8F@PAUMAILU03.ags.agere.com>
In-Reply-To: <46F9AA3C.3227153@dessent.net>
References: <46F9AA3C.3227153@dessent.net>
From: "Williams, Gerald S (Jerry)" <Jerry.Williams@lsi.com>
To: <cygwin@cygwin.com>
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id l8QCmsPU032578

Brian Dessent wrote:
>> $ cd $ttt
>> bash: cd: /cygdrive/c/Program: No such file or directory
> 
> Yes, that's wrong.  [...] It's got nothing to do with
> cygpath and everything to do with proper portable scripting practice.

Quite true. When you're using bash or sh, you must *quote
your arguments* if they could possibly contain spaces or
other word separators. So learn to do it. Seriously, take
a few minutes and try it:

$ mkdir "a b c"
$ ABC="a b c"
bash: cd: a: No such file or directory
$ cd "$ABC"
... etc.

If you don't want to have to quote variable expansions all
the time, use another shell. I know that zsh, at least,
doesn't require you to quote them. That being said, you
still should learn how to quote in a regular POSIX shell.
Portable shell scripts should really start with #!/bin/sh,
after all.

-gsw

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


