Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

using variables from .zshenv in shell scripts



Either something weird is happening or I'm missing something really
basic here. (I blame the cold I've had for 2 weeks.)

I have some variables set in ~/.zshenv which I want to use in shell scripts

However, those variables do not seem to be defined when the shell script runs.

For example, if I have this in ~/.zshenv :

export FOO='BAZ'

and then have a shell script:

#!/bin/zsh

echo "Foo is $FOO"

exit 0

shouldn't it output "Foo is BAZ" ?

Instead, I am getting "Foo is "

I thought that shell scripts would read from ~/.zshenv unless the
first line of the shell script included the '-f' such as "#!/bin/zsh
-f"

is there a 'setopt' that I'm missing here?

TjL

(How have I been writing shell scripts for this long and I'm still not
getting something this basic???)



Messages sorted by: Reverse Date, Date, Thread, Author