From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31569 invoked by alias); 7 Sep 2016 18:09:33 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 31554 invoked by uid 89); 7 Sep 2016 18:09:32 -0000 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 Received: from mailsrv.cs.umass.edu (HELO mailsrv.cs.umass.edu) (128.119.240.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Sep 2016 18:09:31 +0000 Received: from [192.168.24.60] (eduroamgw.cs.umass.edu [128.119.40.194]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id BE892405389A; Wed, 7 Sep 2016 14:09:29 -0400 (EDT) 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> <1709131555.354781.1473264514358@mail.yahoo.com> <15510127987.20160907202742@yandex.ru> To: cygwin@cygwin.com From: Eliot Moss Message-ID: <0f43a751-0fb4-8736-1bcc-10dc4d723a2a@cs.umass.edu> Date: Wed, 07 Sep 2016 18:09:00 -0000 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 X-SW-Source: 2016-09/txt/msg00119.txt.bz2 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