On Tuesday 05 November 2002 06:54 pm, Hal Burgiss wrote:
> On Tue, Nov 05, 2002 at 06:46:29PM -0500, MET wrote:
> > Simply put, I'm trying to check if $2 is set.  Any ideas?
> >
> >     if ( ! $2 ) then
> >             echo You must set a second file
> >             exit 1
> >     fi
> >
> > The above doesn't work reporting if expression error.  Any help would be
> > greatly appreciated.
>
> [ -z "$2" ] && echo "You screwed up" && exit 1

And for bonus points, if the file must already exist, 

[ -f "$2" ] && echo "File $2 does not exist." && exit 1

-------------------------------------------------------------------
DDDD   David Kramer                   http://thekramers.net
DK KD
DKK D  You're just jealous because your company is not powered by
DK KD  an Infinite Improbability Drive.
DDDD   



-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@;redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to