delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/09/07/14:09:49

X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
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 AT cs DOT umass DOT edu
Subject: Re: Bash shell script issue
References: <330568691 DOT 2384551 DOT 1473201409220 DOT ref AT mail DOT yahoo DOT com> <330568691 DOT 2384551 DOT 1473201409220 AT mail DOT yahoo DOT com> <c0b897be-d3cf-f3b9-cf5b-0024a1d395e5 AT redhat DOT com> <1709131555 DOT 354781 DOT 1473264514358 AT mail DOT yahoo DOT com> <15510127987 DOT 20160907202742 AT yandex DOT ru>
To: cygwin AT cygwin DOT com
From: Eliot Moss <moss AT cs DOT umass DOT 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>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019