delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4ED9D066.3040503@xs4all.nl> |
Date: | Sat, 03 Dec 2011 08:31:50 +0100 |
From: | Erwin Waterlander <waterlan AT xs4all DOT nl> |
User-Agent: | Mozilla/5.0 (Windows NT 6.0; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com, frencoo AT gmail DOT com |
Subject: | Re: Illegal character ^M |
References: | <32881791 DOT post AT talk DOT nabble DOT com> |
In-Reply-To: | <32881791.post@talk.nabble.com> |
X-IsSubscribed: | yes |
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 |
frenco schreef, Op 29-11-2011 19:57: > I have a problem with a character. I think it's a conversion problem between > dos and unix. > > I have a variable that is a float value. > When I print it with the echo command i get: > 0.495959 > But when I try to make an operation on that value with the bc command (I am > not sure how to write the bc command). > echo $mean *1000 |bc > > I get: > (standard_in) 1 : illegal character: ^M > > I already use the dos2unix command on my .sh file. > I think it's because my variable have the ^M character (not printed with the > echo command) > > How can i eliminate this error? Hi, Dos2unix will convert only DOS line breaks to Unix line breaks. Meaning \r\n to \n. When you see a single \r (^M), without a following \n, this is a Mac line break. Dos2unix will leave Mac line breaks alone. So you need to run mac2unix instead of dos2unix on the file. regards, -- Erwin Waterlander http://waterlan.home.xs4all.nl/ -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |