invocation-option

bash -c

Execute a command string. The following argument becomes $0; subsequent arguments become positional parameters.

Formal Syntax & Structure

bash syntaxbash
bash -c command [name [args ...]]

Parameters & Attributes

NameTypeDescription
commandstringTrusted command string.
namestringValue for $0.

Return Value

exit status

Execute a command string. The following argument becomes $0; subsequent arguments become positional parameters.

Working Example

Example Snippetbash
bash --noprofile --norc -c 'printf "%s\n" "$0" "$1"' report 'daily report'
Bash Reference