This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jweese
Recipients jweese, nik-sm
Date 2020-02-20.18:46:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582224378.4.0.954203381457.issue39692@roundup.psfhosted.org>
In-reply-to
Content
> So the command_string provided (the first word or the first quoted expression) is interpreted as a shell program, and this program is invoked with the remaining words as its arguments.

Correct.

> As you say, simply slapping quotes around all the args produces a subtle difference: the arg in the position of `$0` is used as an actual positional parameter in one case, and as the shell name in the other case

It is not quite just a shifting of the positional args.

$ bash -c 'f() { printf "%s\n"; }; f "$@"' - foo bar baz
=> "From a string, read this bash script, which defines a function f and then invokes f on all of its arguments. Now invoke that script with an executable name of "-" and the arguments "foo" "bar" and "baz".

$ bash -c 'f() { printf "%s\n"; }; f "$@" - foo bar baz'
=> "From a string, read this bash script, which defines f and then invokes f on all the script arguments as well as "-" "foo" "bar" and "baz". Then invoke that script with no other arguments."
History
Date User Action Args
2020-02-20 18:46:18jweesesetrecipients: + jweese, nik-sm
2020-02-20 18:46:18jweesesetmessageid: <1582224378.4.0.954203381457.issue39692@roundup.psfhosted.org>
2020-02-20 18:46:18jweeselinkissue39692 messages
2020-02-20 18:46:18jweesecreate