Trace of executed programs called by a Bash script

后端 未结 8 1887
难免孤独
难免孤独 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:12

    ~$ help caller
    caller: caller [EXPR]
        Returns the context of the current subroutine call.
    
        Without EXPR, returns "$line $filename".  With EXPR,
        returns "$line $subroutine $filename"; this extra information
        can be used to provide a stack trace.
    
        The value of EXPR indicates how many call frames to go back before the
        current one; the top frame is frame 0.
    

提交回复
热议问题