Bash is behaving correctly; this is not a bug in Bash. And this list is for reporting bugs, not fixing user scripts, so rather than spoon-feed you an explanation, I'm going to give you enough pointers to enable you to discover it for yourself.
Start by reading what the manual says about reading commands from the named file, and what it says about '-c'. Note that it says: - commands are read from the first non-option argument *command_string* . Note that it does *NOT* say - commands are read from the file named by the first non-option argument *file_name*. This difference is critically important. Try exploring some simpler cases, such as: bash -c 'echo abc def' > bash -c echo abc def > bash -c 'echo "arg0={$0} args={$*}"' abc def xyz > bash echo abc def If the explanation still isn't self-evident, try this: type > chmod a-x test.sh and re-do your tests. Explain why one test does not change while the other fails in a different way. -Martin