[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sh script Q



Mike Almogy <lizard@macam98.ac.il> writes:

> Does any one know how can i check if a varible contain any data ,using
> sh script.
> 
> something like if ($param ne ""){....} in perl.

man test?

E.g. 

if [ "$PARAM" != "" ]
   then ...
   else ...
fi

or

if [ -z "$PARAM" ]
   then ...
   else ...
fi

Constructs like ${parameter:?word} (man bash) may also be useful.

Hope it helps.

-- 
Oleg Goldshmidt          goldshmt@netvision.net.il   
BLOOMBERG L.P. (BFM)     oleg@bfr.co.il