Zsh是否与BASH_LINENO等效?

时间:2018-04-15 02:11:14

标签: zsh

This question提到如何在Bash函数中获取行号(也可能是脚本),但我想知道如何在Zsh中执行此操作。

1 个答案:

答案 0 :(得分:2)

zsh只使用LINENO:

  LINENO <S>
          The  line  number of the current line within the current script,
          sourced file, or shell function being  executed,  whichever  was
          started most recently.  Note that in the case of shell functions
          the line number refers to the function as  it  appeared  in  the
          original  definition,  not necessarily as displayed by the func-
          tions builtin.