【发布时间】:2020-10-29 10:39:44
【问题描述】:
当我执行这样的命令时:
bash -c 'command1; command2; command3'
这是什么意思?特别是“-c”是什么意思?
【问题讨论】:
-
您可以使用
man工具和 "man-pages" 找到有关 Linux 命令的帮助。例如。man bash
当我执行这样的命令时:
bash -c 'command1; command2; command3'
这是什么意思?特别是“-c”是什么意思?
【问题讨论】:
man 工具和 "man-pages" 找到有关 Linux 命令的帮助。例如。 man bash
这里已经回答了这个问题: 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.
【讨论】:
来自man bash:
如果存在 -c 选项,则从第一个非选项参数 command_string 中读取命令。如果 command_string 之后有参数,则将第一个参数分配给 $0,并将任何剩余的参数分配给位置参数。对 $0 的赋值设置了 shell 的名称,用于警告和错误消息。
【讨论】: