gpt4 book ai didi

linux - __LINE__ 相当于 Linux shell

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:30:14 25 4
gpt4 key购买 nike

我正在编写一个相当大的 shell 脚本。有没有办法从该脚本打印脚本的行号?基本上我想要类似于 gcc LINE 宏的东西。这将帮助我调试我的脚本。

提前致谢

苏维克

最佳答案

也许这有一点帮助:

http://www.network-theory.co.uk/docs/bashref/BashVariables.html

BASH_LINENO
An array variable whose members are the line numbers in source files corresponding to each member of FUNCNAME. ${BASH_LINENO[$i]} is the line number in the source file where ${FUNCNAME[$i]} was called. The corresponding source file name is ${BASH_SOURCE[$i]}. Use LINENO to obtain the current line number.

关于linux - __LINE__ 相当于 Linux shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3699431/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com