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

Re: Best Way to Test an Environment Variable



# czech@xxxxxxxxx / 2015-10-14 23:32:40 -0700:
> 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).

zshexpn(1):

  ${+name}
      If name is the name of a set parameter `1' is substituted,
      otherwise `0' is substituted.

ps your first email is a reply to an email with a completely unrelated
topic.  don't do that.

  891     Oct 14 jagmeet bali    (  49) ZSH feature request if not present
  892     Oct 14 ZyX             (  53) |->
  893     Oct 14 Peter Stephenso ( 120) | `->
  894     Oct 14 czech@xxxxxxxxx (  60) `->Best Way to Test an Environment Variable
  895     Oct 14 czech@xxxxxxxxx (  73)   `->

-- 
roman



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