$ bash -c 'echo $0 ' foo foo $ bash -c 'echo $0 ' bash
From bash manual
($0) Expands to the name of the shell or shell script. This is set at shell initialization.
If Bash is invoked with a file of commands (see Section 3.8 [Shell Scripts], page 39), $0 is set to the name of that file.
If Bash is started with the -c option (see Section 6.1 [Invoking Bash], page 80), then $0 is set to the first argument after the string to be executed, if one is present.
Otherwise, it is set to the filename used to invoke Bash, as given by argument zero.
What does "otherwise" mean?
What cases does it include?
Does it include the case when bash is started with -c without any "argument after the string to be executed"?
bash -c 'echo $0 ' not to output anything, according to the second case in the quote, but it outputs