This is the mail archive of the
mailing list for the Cygwin project.
Re: Illegal character ^M
- From: Tim McDaniel <tmcd at panix dot com>
- Cc: cygwin at cygwin dot com
- Date: Tue, 29 Nov 2011 14:22:56 -0600 (CST)
- Subject: Re: Illegal character ^M
- References: <firstname.lastname@example.org>
On Tue, 29 Nov 2011, frenco wrote:
I have a variable that is a float value.
When I print it with the echo command i get:
I think it's because my variable have the ^M character (not printed
with the echo command)
You might try
The quoting is significant. If it does have a carriage return like
you think, then it will probably display like
That is, the ^M will probably make it go back to the start of the
line, and characters after it (here, ]) will overwrite what it output
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
How can i eliminate this error?
echo $mean *1000 | tr -d '\r' | bc
seems to work. "tr" translates characters, "-d" says that instead of
translating it should just delete the name characters, and '\r' (note:
single quote ', not double quote ") is the ^M character.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple