X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:references:to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=dTfnw0K/JLDG4d50
	1HY/VnTplAIZdi4znpdSJjrojBQ8NTp/KrclYkDLtxijxJHyREnUmnlZX5j4ttu/
	ZjM2wfQgPRJgYnelmQgUwtmlAU26w9XriZlHNPMas4vAev504UVU5CYrYKT+7PPr
	diW3LILW8/pjRX8WgZCqpNxlezU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:references:to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=p8wwTguEOywQDvGyrDtwNi
	dyR/8=; b=dlJeeJoEtz+04+t7sHbqmxJbrmqOlPSIgiq+BKwjPk2qI1JLDJNG2s
	SNwaXQ0LsfTHkP7TsuHVo2qV9uY18P7l4y8fhEAG50uzi8Zqo0Unm9Gzeyu/nHUV
	58RkYMr2JkYJeqf2FamLW9N/RzSbEFQPNx9dmkPoMtnpPP3YZo9gc=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=andrey, Repin, repin, Andrey
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss@cs.umass.edu
Subject: Re: Bash shell script issue
References: <330568691.2384551.1473201409220.ref@mail.yahoo.com> <330568691.2384551.1473201409220@mail.yahoo.com> <c0b897be-d3cf-f3b9-cf5b-0024a1d395e5@redhat.com> <1709131555.354781.1473264514358@mail.yahoo.com> <15510127987.20160907202742@yandex.ru>
To: cygwin@cygwin.com
From: Eliot Moss <moss@cs.umass.edu>
Message-ID: <0f43a751-0fb4-8736-1bcc-10dc4d723a2a@cs.umass.edu>
Date: Wed, 7 Sep 2016 14:09:21 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
MIME-Version: 1.0
In-Reply-To: <15510127987.20160907202742@yandex.ru>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On 9/7/2016 1:27 PM, Andrey Repin wrote:

>> So "Insufficient quoting" means nothing to me. How should it be?
>
> Put quotes around any variable expansion you are not in control of.
>
>> I was taking the example from a shell script I found.
>
>
>> So I added quoting on the echo:
>
>> #!/bin/bash
>> echo "$PWD"

Yes, that's helpful is PWD contains anything that bash might otherwise act on.

>> project_root=$PWD

But this is more important to change.  There is the \r issue already discussed,
but consider a path such as: Program Files (x86)
It has spaces and parentheses.  What you need to write (and I try to be careful
about this in all cygwin scripts!) is:

project_root="$PWD"

(I like:  project_root="${PWD}"  myself.)

>> x=${project_root}/tools

Similar change required.

Directories under Unix almost never contain spaces, so script writing there
typically does not deal with the strange characters, but they certainly
come up on Windows, and leak through to the Cygwin environment.

Regards -- Eliot Moss

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

