View Single Post

   
  #8 (permalink)  
Old 01-16-2008, 07:39 PM
nobody
 
Posts: n/a
Default Re: check for existence of environment variable


"nobody" <nobody@nowhere.com> schrieb im Newsbeitrag
news:43a3f636$0$11868$3b214f66@tunews.univie.ac.at ...
>
> "Frank Slootweg" <this@ddress.is.invalid> schrieb im Newsbeitrag
> news:43a31d62$0$287$dbd4b001@news.wanadoo.nl...
>> pc <chalk@netspace.net.au> wrote:
>>> hi all,
>>>
>>> I am having a problem checking for the existence of an environment
>>> variable on an new HP-UX box (11.11) under ksh: This script for
>>> example:
>>>...

> Hi !
>
> There is something like :
> ${MyEnvVar?NowSet}
>
> If MyEnvVar is set : nothing will be done ( but an error-message is sent
> to stderr )
> If MyEnvVar ist not set : it will become "NowSet"
>
> To prevent the error-message use :
> Something=${MyEnvVar?NowSet}
>
> My ksh-book is in the company, so I can not look for this topic.
> I will look into the book on monday.
>
> regards
> reinhard dot skarbal at aon dot at
>

To make my answer complete :
MyEnvVar=${MyEnvVar:=0}
If MyEnvVar ist not set : it will become 0
regards
reinhard dot skarbal at aon dot at


Reply With Quote