Another confusing error from someone else's Cygwin setup

Andrey Repin anrdaemon@yandex.ru
Mon Nov 6 17:30:52 GMT 2023


Greetings, David Karr!

> I'm seeing a problem with someone else's Cygwin setup, sort of similar to a
> problem I asked about a couple of weeks ago, in that it's a problem with
> the same user, but seemingly a completely different problem.

> He is using a Bash script that I wrote, and he gets a seemingly nonsensical
> error that I don't understand.

> The script starts out pretty simply, just like this:
> ------------------
> #! /bin/bash
> #set -x
> main() {
> if [ "$1" == "" ]; then
> usage;
> exit;
> fi
> ...
> -----------------

> He was getting a weird error on line 3, just saying this:
> ---------------------
> ...: line 3: syntax error near unexpected token `$'{\r''
> ...: line 3: `main() {
> ---------------

Quick and dirty way to solve your issue -

$ tr -d '\r' > script.fixed < script.erring

> This was pretty perplexing,

It is actually pretty clear, though.

$ od -t x1a < script.erring

See the output.


-- 
With best regards,
Andrey Repin
Wednesday, July 5, 2023 22:22:57

Sorry for my terrible english...



More information about the Cygwin mailing list