Skip to content

Instantly share code, notes, and snippets.

@miry
Last active December 20, 2015 12:28
Show Gist options
  • Save miry/6130847 to your computer and use it in GitHub Desktop.
Save miry/6130847 to your computer and use it in GitHub Desktop.
#!/bin/bash
function info_kill() {
local frame=0
while caller $frame; do
((frame++));
done
echo "kill $*"
}
function f() {
info_kill 1
return
}
echo '>>>> 0'
f
echo '>>>> 1'
f
echo '>>>> 2'
f
@miry
Copy link
Author

miry commented Aug 1, 2013

The output is:

>>>> 0
14 f m.sh
19 main m.sh
kill 1
>>>> 1
14 f m.sh
22 main m.sh
kill 1
>>>> 2
14 f m.sh
25 main m.sh
kill 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment