From: "Michel LaBarre" <michel.labarre@rogers.com>
To: "'Eric Blake'" <eblake@redhat.com>, <cygwin@cygwin.com>,
<kipton_moravec@yahoo.com>
Subject: RE: Bash shell script issue
Date: Wed, 07 Sep 2016 01:41:00 -0000 [thread overview]
Message-ID: <001601d208a8$ee01d0b0$ca057210$@rogers.com> (raw)
In-Reply-To: <c0b897be-d3cf-f3b9-cf5b-0024a1d395e5@redhat.com>
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@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
>
> 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@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
next prev parent reply other threads:[~2016-09-07 1:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <330568691.2384551.1473201409220.ref@mail.yahoo.com>
2016-09-06 22:39 ` Kipton Moravec
2016-09-07 1:21 ` Eric Blake
2016-09-07 1:41 ` Michel LaBarre [this message]
2016-09-07 15:35 ` Kipton Moravec
2016-09-07 15:49 ` Marco Atzeri
2016-09-07 17:41 ` Erik Soderquist
2016-09-07 16:05 ` Andrey Repin
2016-09-07 16:25 ` Kipton Moravec
2016-09-07 16:22 ` Kipton Moravec
2016-09-07 17:35 ` Andrey Repin
2016-09-07 18:09 ` Eliot Moss
2016-09-07 18:28 ` Eric Blake
2016-09-09 19:37 ` Gene Pavlovsky
2016-09-07 19:16 ` Brian Inglis
[not found] ` <32e004cb44addbaefde0839df5500d60@www.ds.net>
[not found] ` <039bcc69d005bf6db5aba99a90f51e36@www.ds.net>
2016-09-07 17:54 ` wilson
2016-09-07 18:13 ` Eliot Moss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001601d208a8$ee01d0b0$ca057210$@rogers.com' \
--to=michel.labarre@rogers.com \
--cc=cygwin@cygwin.com \
--cc=eblake@redhat.com \
--cc=kipton_moravec@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).