Make `envsubst` fail if a variable is not defined
11
votes
2
answers
3268
views
I have a file with a large number of variables in it.
$ cat message.txt
Hello, ${LOCATION}! You too, ${PERSON} ;)
If PERSON
is not defined, envsubst
replaces it with nothing:
$ LOCATION=World envsubst < message.txt
Hello, World! You too, ;)
How can I make envsubst
fail with a non-zero exit code (or something reliable) if any of the many environment variables in the file isn't defined?
Asked by ixe013
(425 rep)
Feb 2, 2022, 09:47 PM
Last activity: Dec 2, 2022, 09:34 PM
Last activity: Dec 2, 2022, 09:34 PM