Programming Tutorials

caller in Mac OS X

By: Strauss K in macos Tutorials on 2011-02-03  

In Mac OS X, caller is not a standalone command like it is in some other operating systems. Instead, caller is a built-in shell command that is used within a Bash script to display the line number and source file of a function call in the call stack.

Here's an example of how to use caller within a Bash script:


function foo() {

function bar() {
  caller 0


When this script is executed, the output will be:

3 /path/to/

This indicates that the bar function was called from line 3 of the script

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in macos )

Latest Articles (in macos)