On 2021/09/01 02:36, David Collier wrote:
Version: GNU bash, version 5.0.3(1)-release (arm-unknown-linux-gnueabihf) Raspberry Pi using Raspbian. Installed from repo? LINENO goes backwards when run sync
LINENO isn't the number of lines executed, but is the linenumber in the source file it is running in (or the line in a function for functions already in memory before you access it. Some examples: Ishtar:/tmp/d> echoln() {
echo "LINENO=$LINENO" }
Ishtar:/tmp/d> echoln LINENO=1 Ishtar:/tmp/d> echoln LINENO=1 Ishtar:/tmp/d> echo $LINENO 262 Ishtar:/tmp/d> saveln="val of lineno=$LINENO" Ishtar:/tmp/d> echo run some stuff run some stuff Ishtar:/tmp/d> echo "lineno=$LINENO, not $saveln" lineno=265, not val of lineno=263 ----
echo "================== At this point \$LINENO has correctly counted
--- LINENO doesn't "count", it is a passive 'count' of where you used the variable "LINENO" (based on some restrictions, like resetting to 1 in functions). Does that clarify anything?