zsh-users
 help / color / mirror / code / Atom feed
From: TJ Luoma <luomat@gmail.com>
To: Zsh-Users List <zsh-users@zsh.org>
Subject: using variables from .zshenv in shell scripts
Date: Wed, 17 Dec 2014 11:16:12 -0500	[thread overview]
Message-ID: <CADjGqHsNGPo5ikqitcpGq49ZpTAJKvoNHmMW-sW6epR5m6+cyQ@mail.gmail.com> (raw)

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???)


             reply	other threads:[~2014-12-17 16:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 16:16 TJ Luoma [this message]
2014-12-17 17:04 ` Bart Schaefer
2014-12-17 19:08   ` TJ Luoma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADjGqHsNGPo5ikqitcpGq49ZpTAJKvoNHmMW-sW6epR5m6+cyQ@mail.gmail.com \
    --to=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).