Skip to content

Conversation

@mschmitzer
Copy link

This is useful for transporting arbitrary settings to applications. It is difficult to implement because shell variable names apparently may not contain dots, but environment variables may. Solving this by parsing the variable name with shlex and re-joining the tokens would swallow white space and thus turn "FOO BAR=baz" into a valid assignment. So use everything up to the assignment operator verbatim as the variable name and only shlex the value.

Environment variables containing dots are handled fine by e.g. the env command and the subprocess module.

This is useful for transporting arbitrary settings to applications. It
is difficult to implement because shell variable names apparently may
not contain dots, but _environment_ variables may. Solving this by
parsing the variable name with `shlex` and re-joining the tokens would
swallow whitespace and thus turn "FOO BAR=baz" into a valid
assignment. So use everything up to the assignment operator verbatim
as the variable name and only shlex the value.

Environment variables containing dots are handled fine by e.g. the `env`
command and the `subprocess` module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant