2018-04-12 17:39:43 +01:00
|
|
|
# envsubst
|
|
|
|
|
|
|
|
> Substitutes shell format strings with environment variables in text.
|
|
|
|
> Strings to be replaced should be in either `${var}` or `$var` format.
|
|
|
|
|
2019-06-17 16:00:38 +01:00
|
|
|
- Replace environment variables in stdin and output to `stdout`:
|
2018-04-12 17:39:43 +01:00
|
|
|
|
|
|
|
`echo '{{$HOME}}' | envsubst`
|
|
|
|
|
2019-06-17 16:00:38 +01:00
|
|
|
- Replace environment variables in an input file and output to `stdout`:
|
2018-04-12 17:39:43 +01:00
|
|
|
|
|
|
|
`envsubst < {{path/to/input}}`
|
|
|
|
|
|
|
|
- Replace environment variables in an input file and output to a file:
|
|
|
|
|
|
|
|
`envsubst < {{path/to/input}} > {{path/to/output}}`
|
|
|
|
|
|
|
|
- Replace environment variables in input from a space-separated list:
|
|
|
|
|
|
|
|
`envsubst {{variables}} < {{path/to/input}}`
|