zsh-users
 help / color / mirror / code / Atom feed
From: czech@sonic.net
To: zsh-users@zsh.org
Subject: Re: Best Way to Test an Environment Variable
Date: Wed, 14 Oct 2015 23:32:40 -0700	[thread overview]
Message-ID: <e9f31b7ad963ccccd870fc2428e9c96f.squirrel@legacy-webmail.sonic.net> (raw)
In-Reply-To: <e1edacefa7810f717d82c35449f30080.squirrel@legacy-webmail.sonic.net>

I probably should have clarified - the objective of the test is to see if
the environment variable is set or not. -z $ENV_VAR seems to return 1 if
the environment variable is not set or is set to null (zero bytes).

Thanks,



Corwin

> Hi -
>
> I've been using:
>
> if [ -z $ENV_VAR ]; then
>
>     <do stuff>
> fi
>
> To test environment variables. It seems to work.
>
> But I'm curious - is there a better way in zsh to test an environment
> variable?
>
> Thanks,
>
>
>
> Corwin
>



  reply	other threads:[~2015-10-15  6:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 14:50 ZSH feature request if not present jagmeet bali
2015-10-14 15:14 ` ZyX
2015-10-14 15:55   ` Peter Stephenson
2015-10-15  6:10 ` Best Way to Test an Environment Variable czech
2015-10-15  6:32   ` czech [this message]
2015-10-15  9:46     ` Roman Neuhauser
2015-10-15 17:34       ` Corwin

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=e9f31b7ad963ccccd870fc2428e9c96f.squirrel@legacy-webmail.sonic.net \
    --to=czech@sonic.net \
    --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).