Expenv.sh evaluates shell expressions, e.g. ${var},
Simply download the expenv.sh file or use a one-liner:
# Download
$ curl -o expenv.sh -- https://raw.githubusercontent.com/blang/expenv.sh/master/expenv.sh && chmod +x ./expenv.sh
# Download and install
$ curl -o expenv.sh -- https://raw.githubusercontent.com/blang/expenv.sh/master/expenv.sh && chmod +x ./expenv.sh && mv ./expenv.sh /usr/bin/
$ cat inputfile | expenv.sh > outputfile
$ expenv.sh -f inputfile > outputfile
$ expenv.sh < inputfile > outputfile
$ expenv.sh -i -f inputfile // Replace inplace
Example input:
My PWD is $PWD
Whoami: ${USER}
I'm using $TERM
Supporting $(echo commands) now!
I need to make config files more dynamic using environment variables. In a docker environment this is a big issue for me. I wrote a small golang project (expenv) to solve this, until Reddit-User vanwho
pointed out a shell one-liner which i adopted in this script.
Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
See LICENSE file.