Trace of executed programs called by a Bash script

后端 未结 8 1865
难免孤独
难免孤独 2020-12-13 14:44

A script is misbehaving. I need to know who calls that script, and who calls the calling script, and so on, only by modifying the misbehaving script.

This is similar

8条回答
  •  借酒劲吻你
    2020-12-13 15:06

    The simplest script which returns a stack trace with all callers:

    i=0; while caller $i ;do ((i++)) ;done
    

提交回复
热议问题