bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Is this a bug


From: arnold
Subject: Re: [bug-gawk] Is this a bug
Date: Sat, 08 Mar 2014 11:26:20 -0700
User-agent: Heirloom mailx 12.4 7/29/08

Hi.

Thank you for taking the time to report a possible bug. As was already
pointed out, the correct spelling is "if" - all lower case, and this
is why you're getting a syntax error.

Thanks,

Arnold

Seppo Lehtikangas <address@hidden> wrote:

> Hi!
>
> I have been using some time to find annoying error in my awk-code.
>
> I had to strip almost the whole code to find the error because awk tells 
> me that there is syntax-error on else-statement(line 12) while the fact 
> is that error is on if-statement(line 9).
>
> Is there some bug or do I have to learn other way interpreted error 
> messages?
>
> My code:
> ===============
> #! /usr/bin/awk -f
> # ~bin/iftest
> #
> {
> #printf "%s %s %s %s \n", ARGV[0], ARGV[1], ARGV[2], ARGV[3]
>
> #if (NF == 0) print "usage iftest [1 | anything]"
>
> If ($1 == 1)
>     {print "number one"
>      printf "%s\n", $0}
> else
>     {if (NF == 0)
>         {print "empty row"}
>      else
>         {print "non one"
>         printf "%s\n", $0}}
> }
> ===============
> running code gives:
> ========
> iftest test
> awk: /mnt/L6EVM/seppo/bin/iftest.error:12: else
> awk: /mnt/L6EVM/seppo/bin/iftest.error:12: ^ syntax error
> ========
>
> Regards
>
> Seppo Lehtikangas
> Enebyberg
> Sweden




reply via email to

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