From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126969 invoked by alias); 7 Sep 2016 18:13:04 -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 126947 invoked by uid 89); 7 Sep 2016 18:13:03 -0000 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 Received: from mailsrv.cs.umass.edu (HELO mailsrv.cs.umass.edu) (128.119.240.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Sep 2016 18:13:02 +0000 Received: from [192.168.24.60] (eduroamgw.cs.umass.edu [128.119.40.194]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id 82393404714A; Wed, 7 Sep 2016 14:13:01 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: Bash shell script issue References: <330568691.2384551.1473201409220.ref@mail.yahoo.com> <330568691.2384551.1473201409220@mail.yahoo.com> <32e004cb44addbaefde0839df5500d60@www.ds.net> <039bcc69d005bf6db5aba99a90f51e36@www.ds.net> To: cygwin@cygwin.com From: Eliot Moss Message-ID: <8d21ab13-417b-7f00-2fe2-344f7a6d1c7d@cs.umass.edu> Date: Wed, 07 Sep 2016 18:13:00 -0000 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: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00120.txt.bz2 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