Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
__Linux shell的行_uu等效_Linux_Shell - Fatal编程技术网

__Linux shell的行_uu等效

__Linux shell的行_uu等效,linux,shell,Linux,Shell,我正在写一个相当大的shell脚本。有没有办法从该脚本打印脚本的行号?基本上,我想要一些类似于gccLINE宏的东西。这将帮助我调试脚本 提前感谢, 苏维克也许这有点帮助: $LINENO变量返回使用该变量的行。不久前我自己做了这件事,当时发现了这篇有用的文章: 基本上,您需要使用$LINENO来获取脚本中的当前行。谢谢大家$LINENO包含行号值。 BASH_LINENO An array variable whose members are the line numbers in so

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

提前感谢,


苏维克

也许这有点帮助:


$LINENO
变量返回使用该变量的行。

不久前我自己做了这件事,当时发现了这篇有用的文章:


基本上,您需要使用
$LINENO
来获取脚本中的当前行。

谢谢大家$LINENO包含行号值。
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.