代码之家  ›  专栏  ›  技术社区  ›  iconoclast

Zsh是否具有与BASH\u LINENO等效的功能?

zsh
  •  2
  • iconoclast  · 技术社区  · 6 年前

    This question 提到了如何在Bash函数(可能还有脚本)中获取行号,但我想知道如何在Zsh中实现。

    1 回复  |  直到 6 年前
        1
  •  2
  •   chepner    6 年前

    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.