variable

Bash BASH_LINENO

Call-site line numbers paired with FUNCNAME and the next BASH_SOURCE element. Distinct from the current LINENO.

Formal Syntax & Structure

bash syntaxbash
${BASH_LINENO[index]}

Return Value

integer

Call-site line numbers paired with FUNCNAME and the next BASH_SOURCE element. Distinct from the current LINENO.

Working Example

Example Snippetbash
cat > trace.bash <<'SCRIPT'show() {  printf '%s:%s\n' "${BASH_SOURCE[0]##*/}" "${BASH_LINENO[0]}"  caller 0}showSCRIPTbash trace.bash
Bash Reference