bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Additional parameters in a #! line throwing unexpected er


From: Jean-Philippe Guérard
Subject: Re: [bug-gawk] Additional parameters in a #! line throwing unexpected error
Date: Sun, 22 Dec 2013 11:18:20 +0100
User-agent: SquirrelMail/1.4.23 [SVN]

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]