Skip to content
Advertisement

Why is my envsubst command just inserting blank strings?

I’m trying to run the command envsubst < myfile to replace environment variables but instead of being replaced with their values, they are being replaced with blank strings.

Here’s my example command (split onto separate lines for clarity):

JavaScript

Here are my results:

JavaScript

I’m clearly doing something obvious wrong, I just have a silly suspicion it’s one of those things that is so obvious that I must be overly complicating my own google searches in trying to find an answer 😅

Advertisement

Answer

The variable is not exported, so it’s not visible to any command. Export it.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement