【问题标题】:Bash command usage meaning [duplicate]Bash命令用法含义[重复]
【发布时间】:2020-10-29 10:39:44
【问题描述】:

当我执行这样的命令时:

bash -c 'command1; command2; command3'

这是什么意思?特别是“-c”是什么意思?

【问题讨论】:

  • 您可以使用 man 工具和 "man-pages" 找到有关 Linux 命令的帮助。例如。 man bash

标签: bash command


【解决方案1】:

这里已经回答了这个问题: What does 'bash -c' do?

男子重击:

-c string If the -c option is present, then commands are read from string.
If there are arguments after the string, they are assigned to the positional 
parameters, starting with $0.

【讨论】:

    【解决方案2】:

    来自man bash

    如果存在 -c 选项,则从第一个非选项参数 command_string 中读取命令。如果 command_string 之后有参数,则将第一个参数分配给 $0,并将任何剩余的参数分配给位置参数。对 $0 的赋值设置了 shell 的名称,用于警告和错误消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-18
      • 2013-05-17
      • 2019-03-13
      • 1970-01-01
      • 1970-01-01
      • 2017-01-21
      • 1970-01-01
      相关资源
      最近更新 更多