Reputation: 27793
I have a strange situation where I'm using zsh full-time, and any bash scripts I run are not picking environment variables properly. Obviously I don't expect bash to pick up env vars that are defined in zsh's environment, so I am using ~/.bashrc
and ~/.bash_profile
, but that doesn't work either.
For example, here's a test script:
#!/bin/bash
echo $MYTEST
I've added this line to both ~/.bashrc
and ~/.bash_profile
to cover my bases:
export MYTEST="hello"
I just get a blank line when running the script.
PS: I know running . ./testscript
will work, but that's not an option since it's a system-wide script that's failing to pull env vars.
Upvotes: 2
Views: 9389
Reputation: 27793
Oops. Maybe I should try having export VAR=val
in my ~/.oh-my-zsh/custom/vars.zsh
instead of just VAR=val
!
Upvotes: 5