From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19764 invoked by alias); 7 Sep 2016 01:41:31 -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 19751 invoked by uid 89); 7 Sep 2016 01:41:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=4.1 required=5.0 tests=AWL,BAYES_50,CYGWIN_OWNER_BODY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=U*kipton_moravec, kipton_moravec@yahoo.com, kipton_moravecyahoocom, sk:kipton_ X-HELO: nm9-vm7.access.bullet.mail.bf1.yahoo.com Received: from nm9-vm7.access.bullet.mail.bf1.yahoo.com (HELO nm9-vm7.access.bullet.mail.bf1.yahoo.com) (216.109.114.198) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Sep 2016 01:41:20 +0000 Received: from [66.196.81.158] by nm9.access.bullet.mail.bf1.yahoo.com with NNFMP; 07 Sep 2016 01:41:18 -0000 Received: from [98.138.104.99] by tm4.access.bullet.mail.bf1.yahoo.com with NNFMP; 07 Sep 2016 01:41:18 -0000 Received: from [127.0.0.1] by smtp119.sbc.mail.ne1.yahoo.com with NNFMP; 07 Sep 2016 01:41:18 -0000 X-Yahoo-SMTP: _oUbE.SswBCQ_d_LvSIk7sZfv6R7Is8n9OVRVjJJh3dhqEgGPCs- From: "Michel LaBarre" To: "'Eric Blake'" , , References: <330568691.2384551.1473201409220.ref@mail.yahoo.com> <330568691.2384551.1473201409220@mail.yahoo.com> In-Reply-To: Subject: RE: Bash shell script issue Date: Wed, 07 Sep 2016 01:41:00 -0000 Message-ID: <001601d208a8$ee01d0b0$ca057210$@rogers.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00107.txt.bz2 Suggestion to Kipton:=20 od -cx =20 will show you exactly what is in your script so you can see any spurious ca= rriage-returns or other special characters. > -----Original Message----- > From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On > Behalf Of Eric Blake > Sent: September-06-16 9:21 PM > To: cygwin@cygwin.com; kipton_moravec@yahoo.com > Subject: Re: Bash shell script issue >=20 > On 09/06/2016 05:36 PM, Kipton Moravec wrote: >=20 > > I this is the script: > > #!/bin/bash > > echo $PWD >=20 > Insufficient quoting. This does not do the right thing if $PWD contains > spaces. But not necessarily related to your problem at hand. >=20 > > project_root=3D$PWD > > echo $project_root >=20 > Again, insufficient quoting. >=20 > > x=3D${project_root}/tools > > echo $x >=20 > And again. >=20 > > echo ${x} | cat -A > > > > On original Windows 7 computer I get: > > dalkmora@DALM0048 > ~/walnut/dp2b_walnut_customer_flextronics/walnut > > $ ./testconvert1.sh > > /home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut > > /home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut > > /toolsdalkmora/walnut/dp2b_walnut_customer_flextronics/walnut > > > /home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut^M/to > ols^M$ >=20 > The carriage returns are likely a product of you editing the file in > text mode (Windows notepad is notorious for this, but many other native > programs do likewise), but trying to execute the script in binary mode > (the default, if you do not use 'set -o igncr'). >=20 >=20 > > What am I doing wrong or is this an error? > > Where do the carriage returns (^M) come from, and how do I get rid of > them? >=20 > d2u /path/to/your/script >=20 > to remove all the carriage returns from your careless editing. Once they > are gone, then you don't need the 'igncr' crutch to tell bash to go into > text mode. >=20 > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org -- 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