From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111709 invoked by alias); 7 Sep 2016 01:21:36 -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 111690 invoked by uid 89); 7 Sep 2016 01:21:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Kipton, kipton, Moravec, moravec X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Sep 2016 01:21:26 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24DDD4E4D2; Wed, 7 Sep 2016 01:21:25 +0000 (UTC) Received: from [10.3.116.152] (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u871LOYi003581; Tue, 6 Sep 2016 21:21:24 -0400 Subject: Re: Bash shell script issue To: cygwin@cygwin.com, kipton_moravec@yahoo.com References: <330568691.2384551.1473201409220.ref@mail.yahoo.com> <330568691.2384551.1473201409220@mail.yahoo.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: Date: Wed, 07 Sep 2016 01:21:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <330568691.2384551.1473201409220@mail.yahoo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8fRlKQhNd12pfXHODcDoffX3pwIOKASFS" X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00106.txt.bz2 --8fRlKQhNd12pfXHODcDoffX3pwIOKASFS Content-Type: multipart/mixed; boundary="lbQ9jeUFKdM0M4bng0moArsN94uTJ1jrC" From: Eric Blake To: cygwin@cygwin.com, kipton_moravec@yahoo.com Message-ID: Subject: Re: Bash shell script issue References: <330568691.2384551.1473201409220.ref@mail.yahoo.com> <330568691.2384551.1473201409220@mail.yahoo.com> In-Reply-To: <330568691.2384551.1473201409220@mail.yahoo.com> --lbQ9jeUFKdM0M4bng0moArsN94uTJ1jrC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 1516 On 09/06/2016 05:36 PM, Kipton Moravec wrote: > I this is the script:=20 > #!/bin/bash=20 > 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. > project_root=3D$PWD=20 > echo $project_root=20 Again, insufficient quoting. > x=3D${project_root}/tools=20 > echo $x=20 And again. > echo ${x} | cat -A=20 >=20 > On original Windows 7 computer I get:=20 > dalkmora@DALM0048 ~/walnut/dp2b_walnut_customer_flextronics/walnut=20 > $ ./testconvert1.sh=20 > /home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut=20 > /home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut=20 > /toolsdalkmora/walnut/dp2b_walnut_customer_flextronics/walnut=20 > /home/dalkmora/walnut/dp2b_walnut_customer_flextronics/walnut^M/tools^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'). > What am I doing wrong or is this an error?=20 > Where do the carriage returns (^M) come from, and how do I get rid of the= m?=20 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --lbQ9jeUFKdM0M4bng0moArsN94uTJ1jrC-- --8fRlKQhNd12pfXHODcDoffX3pwIOKASFS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 604 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXz2uUAAoJEKeha0olJ0NqAgEIAJjW9Tz8QW+2SFv4ry2fln6q IQaUo1zRMxZCOkoQYq+BwLb1AMOxc0zr96fualUKkohRvR8ba4RZq0epsrZEQjXr WhJDrMfk01kwfAyb0hISiqc5tDBmtgiGpkRX4f50GH7dPIqvH02EOCk13t0jJYAL Fp0CEw0m+sX+a+JRJze6lvA6tuHg9gZDBRadH1llA86jXCb2h0mZA0Qh826gDM72 H4XPaHp4JSHpmwb5L2A5mErnThwIy372ZaM9o+53KZhoG8aVx6ZWXZ4AAA6dt3nI BM2495VyUl/udzNRQqLhJre4Pm3HFTNdY/f6ocyrSh11QMt9WKMAmm7+TGTkxC4= =q+ve -----END PGP SIGNATURE----- --8fRlKQhNd12pfXHODcDoffX3pwIOKASFS--