我如何“回显”此命令(脚本中的 NUMBER 行):
Number of lines is 23.
Run Code Online (Sandbox Code Playgroud)
代码:
#!/bin/bash
.
.
.
.
echo Number of line is cat $0 | wc -l
.
.
.
.
Run Code Online (Sandbox Code Playgroud)
这应该可以解决问题。
#!/bin/bash
echo "This script is `wc -l $0 | cut -d " " -f 1` lines long."
Run Code Online (Sandbox Code Playgroud)