public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* An AWK-ward problem...
@ 2011-11-23 20:27 Flint, Paul
  2011-11-23 20:31 ` Christopher Faylor
  2011-11-24  9:19 ` Corinna Vinschen
  0 siblings, 2 replies; 5+ messages in thread
From: Flint, Paul @ 2011-11-23 20:27 UTC (permalink / raw)
  To: cygwin

Greetings List lurkers,

I have been troubleshooting some new bash script that I wrote and wanted (for some reason :^) to run on an NT box.

So the struggle began...

Anyway I get the oddest error:

<snip>
/cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
/cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
warning: LF will be replaced by CRLF in sendjcl.log.
<snap>

So... I check my code and check my code... soon the problem begins to drive me mad...

Then!

I do this from a cygwin ver 2.761 terminal...

$cd /c/cygwin/bin
$dos2unix awk

Now awk works!

The version of Cygwin I am using is 

Thought I would pass this on.

Paul Flint, (802) 828-4262
Office of the System Administrator
Vermont Department of Labor

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: An AWK-ward problem...
  2011-11-23 20:27 An AWK-ward problem Flint, Paul
@ 2011-11-23 20:31 ` Christopher Faylor
  2011-11-24  9:19 ` Corinna Vinschen
  1 sibling, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2011-11-23 20:31 UTC (permalink / raw)
  To: cygwin

On Wed, Nov 23, 2011 at 03:21:36PM -0500, Flint, Paul wrote:
>Greetings List lurkers,
>
>I have been troubleshooting some new bash script that I wrote and wanted (for some reason :^) to run on an NT box.
>
>So the struggle began...
>
>Anyway I get the oddest error:
>
><snip>
>/cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
>/cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
>warning: LF will be replaced by CRLF in sendjcl.log.
><snap>
>
>So... I check my code and check my code... soon the problem begins to drive me mad...
>
>Then!
>
>I do this from a cygwin ver 2.761 terminal...
>
>$cd /c/cygwin/bin
>$dos2unix awk
>
>Now awk works!

Right.  awk doesn't want CRLF line endings.  Remember that Cygwin is a
linux-like environment.  Linux doesn't always deal well with Windows
line endings either.

cgf

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: An AWK-ward problem...
  2011-11-23 20:27 An AWK-ward problem Flint, Paul
  2011-11-23 20:31 ` Christopher Faylor
@ 2011-11-24  9:19 ` Corinna Vinschen
  2011-11-24 12:07   ` Lemke, Michael  SZ/HZA-ZSW
  2011-11-25 14:03   ` Erwin Waterlander
  1 sibling, 2 replies; 5+ messages in thread
From: Corinna Vinschen @ 2011-11-24  9:19 UTC (permalink / raw)
  To: cygwin

On Nov 23 15:21, Flint, Paul wrote:
> Greetings List lurkers,
> 
> I have been troubleshooting some new bash script that I wrote and wanted (for some reason :^) to run on an NT box.
> 
> So the struggle began...
> 
> Anyway I get the oddest error:
> 
> <snip>
> /cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
> /cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
> warning: LF will be replaced by CRLF in sendjcl.log.
> <snap>
> 
> So... I check my code and check my code... soon the problem begins to drive me mad...
> 
> Then!
> 
> I do this from a cygwin ver 2.761 terminal...
> 
> $cd /c/cygwin/bin
> $dos2unix awk
> 
> Now awk works!

I don't believe in this solution:

- The above error messages are not Cygwin gawk error messages.  They
  look like bash error messages.  Bash doesn't understand CRLF line
  endings in scripts unless you explicitly allow that.

- /cygdrive/c/Program Files/Git/bin/awk is apparently the name of a
  shell script.  /cygdrive/c/Program Files/Git/bin/awk is certainly
  not /bin/awk.

- /bin/awk is a symlink to /bin/gawk.exe, an executable.  If you call
  dos2unix on an executable, the executable will be either unchanged,
  or broken with a high probability.

- Even if it doesn't matter in this scenario, Cygwin's gawk understands
  CRLF line endings in awk scripts.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: An AWK-ward problem...
  2011-11-24  9:19 ` Corinna Vinschen
@ 2011-11-24 12:07   ` Lemke, Michael  SZ/HZA-ZSW
  2011-11-25 14:03   ` Erwin Waterlander
  1 sibling, 0 replies; 5+ messages in thread
From: Lemke, Michael  SZ/HZA-ZSW @ 2011-11-24 12:07 UTC (permalink / raw)
  To: cygwin

>On November 24, 2011 10:17 AM Corinna Vinschen wrote:
>
>On Nov 23 15:21, Flint, Paul wrote:
>> Greetings List lurkers,
>> 
>> I have been troubleshooting some new bash script that I wrote and wanted (for some reason :^) to run on an NT box.
>> 
>> So the struggle began...
>> 
>> Anyway I get the oddest error:
>> 
>> <snip>
>> /cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
>> /cygdrive/c/Program Files/Git/bin/awk: line 7: $'\r': command not found
>> warning: LF will be replaced by CRLF in sendjcl.log.
>> <snap>
>> 
>> So... I check my code and check my code... soon the problem begins to drive me mad...
>> 
>> Then!
>> 
>> I do this from a cygwin ver 2.761 terminal...
>> 
>> $cd /c/cygwin/bin
>> $dos2unix awk
>> 
>> Now awk works!
>
>I don't believe in this solution:
>
>- /cygdrive/c/Program Files/Git/bin/awk is apparently the name of a
>  shell script.  /cygdrive/c/Program Files/Git/bin/awk is certainly
>  not /bin/awk.

Actually, this looks like you aren’t running cygwin at all.  Did you
install msys git?  That would install a rudimentary set of unix tools
compiled with mingw, the default path is exactly as in your error
message.  Check your path settings.

Michael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: An AWK-ward problem...
  2011-11-24  9:19 ` Corinna Vinschen
  2011-11-24 12:07   ` Lemke, Michael  SZ/HZA-ZSW
@ 2011-11-25 14:03   ` Erwin Waterlander
  1 sibling, 0 replies; 5+ messages in thread
From: Erwin Waterlander @ 2011-11-25 14:03 UTC (permalink / raw)
  To: cygwin

Op 24-11-2011 10:17, Corinna Vinschen schreef:
> - /bin/awk is a symlink to /bin/gawk.exe, an executable. If you call 
> dos2unix on an executable, the executable will be either unchanged, or 
> broken with a high probability. 

Current dos2unix skips binary files, unless you force the conversion 
with -f, --force.

-- 
Erwin Waterlander
www: http://www.xs4all.nl/~waterlan/


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-25 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-23 20:27 An AWK-ward problem Flint, Paul
2011-11-23 20:31 ` Christopher Faylor
2011-11-24  9:19 ` Corinna Vinschen
2011-11-24 12:07   ` Lemke, Michael  SZ/HZA-ZSW
2011-11-25 14:03   ` Erwin Waterlander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).