delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/09/07/14:13:22

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:reply-to:subject:references:to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=TuYL+fdDebRfAfeD
/ZkXpkw8t0aZB37TqfIMV3+FDrRoedfnqNCJ4C7VVi4qCyMBaE4N+qiNnOVECuc8
gIXN1tgXyBRRHeTVBsKYt1BaCtxvHELYR8PBUp6Bzs1gAwLo5LlTIhaFUVGF+X9d
ETuJ1fZJv9UcRS7i2TcYCrD6gSc=
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:reply-to:subject:references:to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=EhlXInUSXGh+bbjEwbFCf+
mM8bI=; b=gznbCnRA+HPzwBG8s7e54OwmkqzGlKVXdP7rHd/qHO/stNp3NuTmHh
eU18ixCoa1U4UErpQcUAWp8E649ed/MccOuzXpzwgdjq4AZqbP8L8KcPHzFbNGfQ
rAaga2c79T+hoJUyli0Wb/WzyTwo9gpj+pFZsXtZtQaMrqnJJBFUA=
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=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=endings, H*i:sk:e9f9ac1, H*f:sk:e9f9ac1, umm
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss AT cs DOT umass DOT edu
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> <32e004cb44addbaefde0839df5500d60 AT www DOT ds DOT net> <039bcc69d005bf6db5aba99a90f51e36 AT www DOT ds DOT net> <e9f9ac1e0d6ded5f61d3ea784026e396 AT www DOT ds DOT net>
To: cygwin AT cygwin DOT com
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Message-ID: <8d21ab13-417b-7f00-2fe2-344f7a6d1c7d@cs.umass.edu>
Date: Wed, 7 Sep 2016 14:12:35 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
MIME-Version: 1.0
In-Reply-To: <e9f9ac1e0d6ded5f61d3ea784026e396@www.ds.net>
X-IsSubscribed: yes

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

- Raw text -


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