delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/09/06/21:41:54

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:from:to:references:in-reply-to:subject:date
:message-id:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=l4WOhAALuQVcq1Fqo6+1DDAmD5AX9YTVID2I29CBuqK
dXOUWbOCyULYXxhuNjfzsbl+akKhccCppastoHYKsMXqazJ8tHif4r4eo1j95iW/
swGd98fY9Y6k98iyObH71dG5jxWFzgt01A2Mc6WxLUAZOdsrBaXbS6peOxRid7/g
=
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:from:to:references:in-reply-to:subject:date
:message-id:mime-version:content-type:content-transfer-encoding;
s=default; bh=jK79pxL3XiGrrToPaKsgwArwipU=; b=KSIHKJMokA2hb2aHI
eqUyuZojc3L8RscwpMmt3KKPIVpQI8k3BhE4vrT0lLkuxVCPyudoVAyXWnZaWM4T
26dU6AB5drNjoCKwxdEP6j5QGokMfZhq7RfmspYarv3WjFGm2laCsxhQHqP6jR7r
gS7IaixsdUbqIvBnWbRjNBrad8=
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=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 AT yahoo DOT com, kipton_moravecyahoocom, sk:kipton_
X-HELO: nm9-vm7.access.bullet.mail.bf1.yahoo.com
X-Yahoo-SMTP: _oUbE.SswBCQ_d_LvSIk7sZfv6R7Is8n9OVRVjJJh3dhqEgGPCs-
From: "Michel LaBarre" <michel DOT labarre AT rogers DOT com>
To: "'Eric Blake'" <eblake AT redhat DOT com>, <cygwin AT cygwin DOT com>,
<kipton_moravec AT yahoo DOT com>
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>
In-Reply-To: <c0b897be-d3cf-f3b9-cf5b-0024a1d395e5@redhat.com>
Subject: RE: Bash shell script issue
Date: Tue, 6 Sep 2016 21:41:16 -0400
Message-ID: <001601d208a8$ee01d0b0$ca057210$@rogers.com>
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u871fn8S003727

Suggestion to Kipton: 
    od -cx <name-of-your-script> 
will show you exactly what is in your script so you can see any spurious carriage-returns or other special characters.

> -----Original Message-----
> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On
> Behalf Of Eric Blake
> Sent: September-06-16 9:21 PM
> To: cygwin AT cygwin DOT com; kipton_moravec AT yahoo DOT com
> Subject: Re: Bash shell script issue
> 
> On 09/06/2016 05:36 PM, Kipton Moravec wrote:
> 
> > I this is the script:
> > #!/bin/bash
> > echo $PWD
> 
> Insufficient quoting. This does not do the right thing if $PWD contains
> spaces.  But not necessarily related to your problem at hand.
> 
> > project_root=$PWD
> > echo $project_root
> 
> Again, insufficient quoting.
> 
> > x=${project_root}/tools
> > echo $x
> 
> And again.
> 
> > echo ${x} | cat -A
> >
> > On original Windows 7 computer I get:
> > dalkmora AT 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$
> 
> 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').
> 
> 
> > 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?
> 
> d2u /path/to/your/script
> 
> 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.
> 
> --
> 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


- Raw text -


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