[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "-M" option does not work as expected with switch statement
From: |
arnold |
Subject: |
Re: "-M" option does not work as expected with switch statement |
Date: |
Sun, 05 Jul 2020 05:46:50 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Thanks for the report. I see the same thing. I will work on a fix.
Arnold
Hyunho Cho<mug896@naver.com> wrote:
> GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)
> Operating System: Ubuntu 20.04 LTS
> Kernel: Linux 5.4.0-39-generic
> Architecture: x86-64
>
> ### Without "-M" option work as expected
>
> bash$ awk '
> {
> switch ($1) { case "A" : arr[1] = $1 }
> print "value: " arr[1]
> }
> '
> A <------------ this is a user input
> value: A <------------ the result as expected
>
> ### If i add "-M" option then value become "0"
>
> bash$ awk -M '
> {
> switch ($1) { case "A" : arr[1] = $1 }
> print "value: " arr[1]
> }
> '
> A
> value: 0 <--------- value become "0"
>
> ### No such error occurred without switch statement
>
> bash$ awk -M '
> {
> arr[1] = $1
> print "value: " arr[1]
> }
> '
> A
> value: A