help-bash
[Top][All Lists]
Advanced

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

Re: bottom of ${BASH_LINENO[*]} stack is always '0'


From: alex xmb ratchev
Subject: Re: bottom of ${BASH_LINENO[*]} stack is always '0'
Date: Fri, 17 Feb 2023 21:15:29 +0100

whats this | will it be fixed

i once did a file transfer app , with socat and exec where possible
when testing , i saw code if the script in connection / testing .. i made
the exec s away and it began magically to work ( not leak its source .. )

On Thu, Feb 9, 2023, 10:11 PM bill-auger <bill-auger@peers.community> wrote:

> the bottom of the ${BASH_LINENO[*]} stack is always '0'; and the
> array never contains the line number of the actual call site, as
> ${LINENO} does - is that expected behavior?
>
> posting to this list; because im not sure if this is a bug or not
> - it seems like a bug to me though - obviously the '0' value is
> meaningless
>
>
> $ cat ./bash_lineno.sh
> #!/bin/bash
>
> echo "[LOC_${LINENO} ]: ${BASH_LINENO[@]}"
>
> f1()
> {
>   echo "[LOC_${LINENO} ]: ${BASH_LINENO[@]}"
>   f2 # LOC_8
> }
>
> f2()
> {
>   echo "[LOC_${LINENO}]: ${BASH_LINENO[@]}"
> }
>
> f1 # LOC_16
>
> echo "[LOC_${LINENO}]: ${BASH_LINENO[@]}"
>
>
> $ ./bash_lineno.sh
> [LOC_3 ]: 0
> [LOC_7 ]: 16 0
> [LOC_13]: 8 16 0
> [LOC_18]: 0
>
>
> $ bash --version
> GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
>
>
> system is parabola x86_64 (archlinux)
>
>


reply via email to

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