[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Definition of BASH_LINENO/FUNCNAME
From: |
marty leisner |
Subject: |
Definition of BASH_LINENO/FUNCNAME |
Date: |
Wed, 3 Oct 2007 02:32:40 -0400 |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables
uname output: Linux dell2.home 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005
i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu
Bash Version: 3.0
Patch Level: 16
Release Status: release
Description:
Confusion in manual or bug about BASH_LINENO
The manual says:
`BASH_LINENO'
An array variable whose members are the line numbers in source
files corresponding to each member of FUNCNAME.
`${BASH_LINENO[$i]}' is the line number in the source file where
`${FUNCNAME[$i]}' was called. The corresponding source file name
is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain the current line
number.
It seeams ${FUNCNAME[$i]} is matched by ${BASH_LINENO[$i-1]} as a pair.
Repeat-By:
: leisner@dell3 02:28:01;nl -b a bug.sh
1 #! /bin/bash
2
3 function fail
4 {
5 echo Fatal Failure in ${FUNCNAME[1]}:${BASH_LINENO[0]}: $*
6 exit 1
7 }
8
9 function bar
10 {
11 echo ${FUNCNAME[@]}
12 echo ${BASH_LINENO[@]}
13 fail "this is confusing"
14
15
16 }
17
18 function foo
19 {
20 bar
21 }
22
23 foo
: leisner@dell3 02:28:33;bash ./bug.sh
bar foo main
20 23 0
Fatal Failure in bar:13: this is confusing
Fix:
Change the manual. Or this may be a bug?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Definition of BASH_LINENO/FUNCNAME,
marty leisner <=