1

This question already has an answer here:

Bash Manual says about bash -c <some-command>:

Read and execute commands from the first non-option argument after processing the options, then exit. Any remaining arguments are assigned to the positional parameters, starting with $0.

What do the following mean:

  • "the first non-option argument after processing the options"
  • "Any remaining arguments are assigned to the positional parameters, starting with $0"

In the second one, are the positional parameters for bash or for some-command?

marked as duplicate by cuonglm bash Apr 15 '16 at 2:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

"the first non-option argument after processing the options"

This is talking about options to your invocation of bash. -c, for example, is an option you're applying to bash in your example that would not be sent to any command you're invoking.

"Any remaining arguments are assigned to the positional parameters, starting with $0"

What this means, is that if you execute bash -c /path/to/script arg1 arg2, the specified script will be executed with /path/to/script, arg1, and arg2 being assigned to the positional parameters $0, $1, and $2 respectively, just as though you had run the command in an interactive bash session.

Not the answer you're looking for? Browse other questions tagged or ask your own question.