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

Re: Best Way to Test an Environment Variable



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
>




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