Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2017-10-21 17:46:39
Size: 568
Comment:
Revision 4 as of 2017-10-21 19:02:45
Size: 625
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
 * [[../|Invocation Options]]
* [[bash/invocation/option|Invocation Options]]
Line 6: Line 7:
==== Invocation Option C ====
==== Invocation Option c ====
Line 8: Line 10:
-c
If the -c option is present, then commands are read from the first non-option argument command_string.
If there are arguments after the command_string, the first argument is assigned to $0 and any remaining arguments are assigned to the positional parameters.
The assignment to $0 sets the name of the shell, which is used in warning and error messages.
[[bash/invocation/option/c|-c]] `[`[[../|options]]`]` `--` [[bash/invocation/mode/CommandString|CommandString]] `[ARG0 [ARG...]]`
 * commands are read from the first non-option argument (required)
 * `$0` is set as the second non-option argument defaulting to "`bash`"
 * all remaining non-option arguments are assigned to the positional parameters starting at `$1`
 * `[[ $- =~ c ]]` will return true

1. Invocation Option c


-c [options] -- CommandString [ARG0 [ARG...]]

  • commands are read from the first non-option argument (required)
  • $0 is set as the second non-option argument defaulting to "bash"

  • all remaining non-option arguments are assigned to the positional parameters starting at $1

  • [[ $- =~ c ]] will return true

bash/invocation/option/c (last edited 2017-10-21 19:02:45 by Robert Robertson)