Substitute environment variables in a string
Project description
Substitute environment variables in a string:
>>> import os >>> from envsubst import envsubst >>> del os.environ['PS1'] >>> print(envsubst('$USER@$HOST ${PS1:-$}:')) ashafer01@github.com $: >>> os.environ['PS1'] = '' >>> print(envsubst('$USER@$HOST ${PS1:-$}:')) ashafer01@github.com $: >>> print(envsubst('$USER@$HOST ${PS1-foo}:')) ashafer01@github.com : >>> os.environ['DEFAULT_PROMPT'] = '$' >>> print(envsubst('$USER@$HOST ${PS1:-$DEFAULT_PROMPT}:'))
Also supports $0, $1, etc. from argv.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
envsubst-0.1.4.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for envsubst-0.1.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cff54bb1318f4d2b234e9cf106d8c74a358ca3e84a16d36eadf2cf64086dc56 |
|
MD5 | 0008f1d89b54fe3f0d0efb0a3c682434 |
|
BLAKE2b-256 | 296b287e381277c0947bcf4dc5e19fe9a2f7a714e0026042550cf00f3885a8ba |