LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   $LINENO can't be modified in bash 3.0, while it can be in bash 2.05b (https://www.linuxquestions.org/questions/linux-software-2/%24lineno-cant-be-modified-in-bash-3-0-while-it-can-be-in-bash-2-05b-380821/)

Darwish 11-07-2005 12:33 PM

$LINENO can't be modified in bash 3.0, while it can be in bash 2.05b
 
I've noticed that the $LINENO can't be modified in bash 3.0. I made a
script (bash debugger) which modify LINENO to a specific value before
using it, it worked in bash 2.05b. but in bash 3.0, even if i've
changed it's value, it counts from "one" like nothing happened

Ex:
------------------------------------------
#! /bin/bash
LINENO=-2
echo "Line = $LINENO"
echo "Line = $LINENO"
echo "Line = $LINENO"
echo "Line = $LINENO"
-------------------------------------------

*result in bash 2.05b:
Line = -1
Line = 0
Line = 1
Line = 2

*result in bash 3.0:\
Line = 3
Line = 4
Line = 5
Line = 6

Is this a bug ?!! and how to change LINENO value in bash3.0
Thanks for help

Darwish 11-07-2005 02:57 PM

Well, it's the third time i post a message and i find the reply exactly after sending...
It's not a bug, since bash 3.0 has changed the way it counts the line number
I can't assign a value to LINENO since when u do echo "$LINENO", bash looks to a built in functions not to LINENO itself...
<The answer from the bash bug Usenet group>


All times are GMT -5. The time now is 03:33 PM.