HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

caller — Print function context. More information: <https://www.gnu.org/software/bash/manual/bash.html#index-

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandfunctioncliprintcallerinformationmorecontext

Problem

How to use the caller command: Print function context. More information: <https://www.gnu.org/software/bash/manual/bash.html#index-caller>.

Solution

caller — Print function context. More information: <https://www.gnu.org/software/bash/manual/bash.html#index-caller>.

Print the line and filename where the current function was called:
caller


Print the line, function, and filename where the current function was called:
caller 0


Print the line, the function name, and the filename of a function call n frames back:
caller {{n}}

Code Snippets

Print the line and filename where the current function was called

caller

Print the line, function, and filename where the current function was called

caller 0

Print the line, the function name, and the filename of a function call `n` frames back

caller {{n}}

Context

tldr-pages: common/caller

Revisions (0)

No revisions yet.