Bash 5.0 的 --pretty-print 选项是做什么用的?

paw*_*moy 5 bash

使用 Bash 5.0:

$ bash --help
GNU bash, version 5.0.0(1)-release-(x86_64-pc-linux-gnu)
Usage:  bash [GNU long option] [option] ...
    bash [GNU long option] [option] script-file ...
GNU long options:
    --debug
    --debugger
    --dump-po-strings
    --dump-strings
    --help
    --init-file
    --login
    --noediting
    --noprofile
    --norc
    --posix
    --pretty-print
    --rcfile
    --restricted
    --verbose
    --version
Run Code Online (Sandbox Code Playgroud)

这个--pretty-print选项是什么?我在 Bash 5.0 手册页和互联网上都找不到它!好神秘:O

paw*_*moy 5

找到了 8)

在代码源中,CWRU/changelog第 1427 行:

shell.c
    - --pretty-print: new invocation option, currently undocumented, dumps
      a pretty-printed version of a shell script given as an argument to
      stdout
Run Code Online (Sandbox Code Playgroud)

我刚刚尝试过,它的工作原理类似于type函数,但适用于整个脚本!整洁的。评论将被删除!