This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Bash shell script issue
- From: Eliot Moss <moss at cs dot umass dot edu>
- To: cygwin at cygwin dot com
- Date: Wed, 7 Sep 2016 14:12:35 -0400
- Subject: Re: Bash shell script issue
- Authentication-results: sourceware.org; auth=none
- References: <330568691.2384551.1473201409220.ref@mail.yahoo.com> <330568691.2384551.1473201409220@mail.yahoo.com> <32e004cb44addbaefde0839df5500d60@www.ds.net> <039bcc69d005bf6db5aba99a90f51e36@www.ds.net> <e9f9ac1e0d6ded5f61d3ea784026e396@www.ds.net>
- Reply-to: moss at cs dot umass dot edu
On 9/7/2016 2:12 PM, wilson wrote:
>
>> On 2016-09-06 18:36, Kipton Moravec wrote: I am relatively new to shell scripts, but this works on
>> linux and I do not know why it does not work for me in cygwin. ... 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?
>
> The (^M -Control M) characters are displayed because Windows is stupid and didn't do the sensible
> thing for End Of Line for plain text files. Linux/Unix uses a Carriage Return (CR) followed by a
> Line Feed (LF) to do an EOL. A Google search for "Control M Character" will bring up a lot of web
> sites dealing with explaining this.
>
> You need to run "dos2unix" or "unix2dos" on your script to convert the EOL to the proper OS
> formatting when transferring between real Linux/Unix machines and Windows machines. These utilities
> are available in the Cygwin utilities download (look for it), but I'm not sure they are included in
> the basic default packages.
Umm, Linux/Posix does NOT include ^M (CR) in line endings, only ^J (NL). Older Apple
systems used ^M only, but newer ones have a Unix-like OS under the hood and are thus
more Posix-like.
Regards -- Eliot Moss
--
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