[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Additional parameters in a #! line throwing unexpected er
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Additional parameters in a #! line throwing unexpected error |
Date: |
Thu, 26 Dec 2013 06:17:42 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
As others have pointed out, this has to do with how the #! line works
and isn't a gawk problem.
Thanks,
Arnold
> Date: Sun, 22 Dec 2013 11:18:20 +0100
> From: "Jean-Philippe Gu?rard" <address@hidden>
> To: "Tim Chase" <address@hidden>
> Cc: address@hidden
> Subject: Re: [bug-gawk] Additional parameters in a #! line throwing
> unexpected error
>
> Le Sam 21 d?cembre 2013 22:15, Tim Chase a ?crit :
> > While this works:
> >
> > #!/usr/bin/awk -f
> > BEGIN {FS="."}
> > {print $1}
> >
> > the following doesn't
> >
> > #!/usr/bin/awk -F. -f
> > {print $1}
>
> Linux (and some other Unix implementations) does not split the arguments
> of the command following the shebang (#!):
>
> #!/usr/bin/awk -F. -f
> {print $1}
>
> is equivalent to:
>
> #!/usr/bin/awk "-F. -f"
> {print $1}
>
> This gives us a one line equivalent of:
>
> $ echo "hello.world" | gawk "-F: -f" ./demo.awk
> gawk: cmd. line:1: ./demo.awk
> gawk: cmd. line:1: ^ syntax error
> gawk: cmd. line:1: ./demo.awk
> gawk: cmd. line:1: ^ unterminated regexp
>
> HTH
>
> Regards.
>
> --
> Jean-Philippe Gu?rard
> http://tigreraye.org