在这个 bash 脚本中,“-”是什么意思?又怎么能知道它的意思呢?
In this bash script, what does "-" mean? And how could one find out what it means?
这是脚本:
node /app/ganache-core.docker.cli.js — quiet \ — account=”0x873c254263b17925b686f971d7724267710895f1585bb0533db8e693a2af32ff,100000000000000000000" \ — account=”0x8c0ba8fece2e596a9acfc56c6c1bf57b6892df2cf136256dfcb49f6188d67940,100000000000000000000"
我读过 What's the magic of "-" (a dash) in command-line parameters?。我认为它可以表示标准输入...如果 bash 程序的作者这样定义它。
但是,here(link 到 ganache-core.docker.cli.js github 文件),我找不到 ganache-core.docker.cli.js 的作者如何或在哪里定义破折号("-") 作为标准输入。有人也可以指出这一点吗?
编辑:我正在寻找破折号确实表示 cli args 的标准输入的确认,但更重要的是希望了解,为什么根据 linked 问题将它们明确解释为 stnin以上只是一个约定。
Edit2:我怀疑 CLI arg 解析库是 yArgs
此命令行格式错误。你正在阅读不存在的东西。一些博客软件作者认为 auto-reformat 文章是一个聪明的主意,因此连字符等是长破折号,引号是“聪明的”等等。最后,不知何故 space 在 space 之后结束了破折号,在下一个参数之前。
比如,我们来看这个:
node /app/ganache-core.docker.cli.js — quiet
即使我们假设这是一个常规连字符 -
,我们也知道它后面不应该有 space。应该是-quiet
。而且,如果您对此有任何疑问,可以 read in the source code where this is defined:
.option('q', {
group: 'Other:',
alias: 'quiet',
describe: 'Run ganache quietly (no logs)',
type: 'boolean',
default: false
})
-account
也是如此。
And I took away that it CAN mean standard input... if the authors of the bash program define it as such.
是的,没错。我不知道这个软件是做什么的,但如果它是从 STDIN 读取的,那不是因为你在命令行上告诉它的。这是因为它就是这样做的。
这是脚本:
node /app/ganache-core.docker.cli.js — quiet \ — account=”0x873c254263b17925b686f971d7724267710895f1585bb0533db8e693a2af32ff,100000000000000000000" \ — account=”0x8c0ba8fece2e596a9acfc56c6c1bf57b6892df2cf136256dfcb49f6188d67940,100000000000000000000"
我读过 What's the magic of "-" (a dash) in command-line parameters?。我认为它可以表示标准输入...如果 bash 程序的作者这样定义它。
但是,here(link 到 ganache-core.docker.cli.js github 文件),我找不到 ganache-core.docker.cli.js 的作者如何或在哪里定义破折号("-") 作为标准输入。有人也可以指出这一点吗?
编辑:我正在寻找破折号确实表示 cli args 的标准输入的确认,但更重要的是希望了解,为什么根据 linked 问题将它们明确解释为 stnin以上只是一个约定。
Edit2:我怀疑 CLI arg 解析库是 yArgs
此命令行格式错误。你正在阅读不存在的东西。一些博客软件作者认为 auto-reformat 文章是一个聪明的主意,因此连字符等是长破折号,引号是“聪明的”等等。最后,不知何故 space 在 space 之后结束了破折号,在下一个参数之前。
比如,我们来看这个:
node /app/ganache-core.docker.cli.js — quiet
即使我们假设这是一个常规连字符 -
,我们也知道它后面不应该有 space。应该是-quiet
。而且,如果您对此有任何疑问,可以 read in the source code where this is defined:
.option('q', {
group: 'Other:',
alias: 'quiet',
describe: 'Run ganache quietly (no logs)',
type: 'boolean',
default: false
})
-account
也是如此。
And I took away that it CAN mean standard input... if the authors of the bash program define it as such.
是的,没错。我不知道这个软件是做什么的,但如果它是从 STDIN 读取的,那不是因为你在命令行上告诉它的。这是因为它就是这样做的。