bug-bash
[Top][All Lists]
Advanced

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

Re: unreliable value of LINENO variable


From: alex xmb sw ratchev
Subject: Re: unreliable value of LINENO variable
Date: Mon, 4 Dec 2023 20:06:50 +0100

i ve experienced many ghost fails .. got better over time and knowerledge

greets

On Mon, Dec 4, 2023, 18:21 Chet Ramey <chet.ramey@case.edu> wrote:

> On 12/4/23 8:46 AM, Giacomo Comes wrote:
> > I use often the value of LINEO in order
> > to know where to look for issues in a script.
> > Recently I discovered a bug.
> >
> > Please consider the following 6 line script:
> > ------------------------------------------------
> > #!/bin/bash
> >
> > if ((1)); then
> >         ( : ) ; echo 1 $LINENO
> > fi
> > echo 2 $LINENO
> > ------------------------------------------------
> > if executed it should print:
> > 1 4
> > 2 6
> > And indeed that's the output if I run it on openSUSE Leap 15.5
> > (bash 4.4). However if I execute it on openSUSE tumbleweed
> > (bash 5.2) the  output is:
> > 1 4
> > 2 5
>
> I can't reproduce this. I get the correct (bash-4.4) results on bash-5.1
> and bash-5.2. There does seem to be a problem with bash-5.0, but it was
> corrected in bash-5.1, according to my results.
>
> This is the case for both of your example scripts.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>
>


reply via email to

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