Closed scalp42 closed 2 years ago
Hey @scalp42. I think this is a misunderstanding of how and when your shell interpolates environment variables. When you run
honcho -e .env run echo $NAME
it's your shell (and not honcho) that interpolates the value of $NAME
before running the command. If $NAME
isn't set then it will evaluate to nothing and the command you run will actually be
honcho -e .env run echo
which, understandably, just prints a newline.
You should be able to confirm that honcho itself exposes environment variables loaded from .env
files by running something like this instead:
honcho -e .env run sh -c 'echo $NAME'
I expect that will print what you are hoping for.
You can also verify that it's your shell that's doing the interpolation of an empty variable by rerunning your command after running set -u
in your shell. You'll probably see something like this:
$ set -u
$ honcho run -e .env echo $NAME
bash: NAME: unbound variable
Oh wow I feel stupid for missing this 🙈
Thanks for the quick answer by the way and thank you for the project! 🙏
Hey @nickstenning
Quick testing and running into an issue.
Assuming the following
.env
:Result seems off:
Where I would have expected:
Let me know if I'm missing anything, thanks in advance! 🙌