This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Illegal character ^M


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]