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.5.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for envsubst-0.1.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7188f9f2a046e45b63098ce5a7fd84126cbe9e5b73b8ff78eaf6e32122c0caaf |
|
MD5 | 88499f95db170e1bc646617614c19c61 |
|
BLAKE2b-256 | bd295ab85c5e436f9c921a7fab2b2a5c7fa5069c777312586483fa4ca90a7cad |