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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=m3h4 OzETLBFHSYSlfG17rMs+s8bvfT2+0nCotD0zrhnHYgEs51eHYNBkvZqeij34qQyo gWU7jwSl3qYBaJIKYItgx8aMSZ+DC0CMEfhh3h8Kqt9f127fSijjwvc3imlKpqV3 q/FOJADVyEXjwO87DGw7kFklD1BzKMP8mHmi78Q= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=yaQlqoZPQB e6RNEt4GYplchiAwE=; b=lR80+CbPdAOyGLu+xvPyElDuW4qrmmNhinleClocJA TjnNFgLzSBU0f2lFOVP5KVD2AWxZltvJPxVK4KPlWMkyjNVBo/7QA6p3tSUDjq7G CA1Kv/jY/4AJpb/LEFq7Jaeuw+TrYPI15MwpYuY/5DZpHeOJt5MS2oOb2Ss3zVzu 0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-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 Subject: Re: Bash shell script issue To: 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> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: Date: Tue, 6 Sep 2016 20:21:23 -0500 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 --8fRlKQhNd12pfXHODcDoffX3pwIOKASFS Content-Type: multipart/mixed; boundary="lbQ9jeUFKdM0M4bng0moArsN94uTJ1jrC" From: Eric Blake To: cygwin AT cygwin DOT com, kipton_moravec AT yahoo DOT com Message-ID: 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> In-Reply-To: <330568691 DOT 2384551 DOT 1473201409220 AT mail DOT yahoo DOT com> --lbQ9jeUFKdM0M4bng0moArsN94uTJ1jrC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 AT 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" -----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--