Reputation: 71
Completely perplexed at this behaviour.
env
is not displaying the variable but echo
is displaying it.
i was routinely testing a .env file import using env | grep VAR
but somehow it did not show right after i sourced it. that got me thinking.
Here are the steps i am using to get the problem.
$ cat >.env
TARXAN=wat
^D
$ . .env
$ echo $TARXAN
wat
$ env | grep TARXAN
$
i have zsh with oh-my-zsh. don't have any dotenv plugins enabled. would appreciate any help. i am in kubuntu 20.04.
I have also tested this entire setup in xterm. same result.
Upvotes: 5
Views: 2363
Reputation: 1935
It's not displayed by env
because TARXAN
is not an environment variable, i.e. it has not been exported. It's a shell variable only.
Upvotes: 10