X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Andrew DeFaria <Andrew@DeFaria.com>
Subject:  Re: stupid spaces in environment vars
Date:  Fri, 09 Feb 2007 10:12:59 -0600
Lines: 41
Message-ID: <eqi6ic$it3$1@sea.gmane.org>
References:  <84952F09F3FC0C418393E60D116EB9CC126C47@Traf-Mail.int.ascribe.com>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:  7bit
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
In-Reply-To: <84952F09F3FC0C418393E60D116EB9CC126C47@Traf-Mail.int.ascribe.com>
X-IsSubscribed: yes
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

Phil Betts wrote:
> David Bear wrote on Friday, February 09, 2007 4:56 AM::
>> Okay, the problem is in quoting in shell scripts, I think.
> It is. It's not a Windows problem and it certainly isn't a cygwin problem.
>
> Although spaces occur more often in Windows than on other platforms, 
> they can and do occur on Unix/Linux for example. Any properly written 
> shell script must be written with the assumption that a path contains 
> spaces. If they aren't, at best they are broken, at worst they are a 
> security risk.
>
> If you're going to write shell scripts, learn to do it right. Learn 
> the quotation rules, by which I mean both knowing what
> they are and UNDERSTAND them.
>
> Windows is only making you more aware of the issues because so many 
> important paths include spaces. (Quite why anyone would *want* to 
> create a path with spaces in it, particularly important paths, is 
> beyond me, but then MS does a lot of dumb things)
As you quite rightly point out spaces (as well as many other troublesome 
characters) are allowed in pathnames. As such why anyone would want to 
create a path with spaces in it is quite simple - because it's allowed. 
Also, because it's more "readable" and finally because in Windows most 
people don't mess with the command line where the spaces become 
troublesome and must be escaped or quoted.

All that said, when in Cygwin, since I'm in a POSIX like environment, I 
seek to make things more Unix like than have them remain Windows like. 
As such I usually have the following mounts to change some of those 
common troubling important paths to 1) be shorter, 2) more Unix like and 
3) not contain spaces:

    $ mount -bsf C:/Documents\ and\ Settings /home
    $ mount -bsf C:/Program\ Files /apps

YMMV


-- 
Andrew DeFaria <http://defaria.com>
If God wanted me to touch my toes, he would have put them on my knees.


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

