builtin
Bash caller
Displays active call context. With a frame index, displays line, function and file; status is nonzero if the requested frame is unavailable.
Formal Syntax & Structure
bash syntaxbash
caller [expr]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| expr | integer | Frame index, zero for current function call. |
Return Value
exit status
Displays active call context. With a frame index, displays line, function and file; status is nonzero if the requested frame is unavailable.
Working Example
Example Snippetbash
cat > trace.bash <<'SCRIPT'show() { printf '%s:%s\n' "${BASH_SOURCE[0]##*/}" "${BASH_LINENO[0]}" caller 0}showSCRIPTbash trace.bash