Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bloom-beacon!oberon!cit-vax!ucla-cs!zen!ucbcad!ames!lll-tis!ptsfa!ihnp4!homxb!mtuxo!mtune!codas!ablnc!latham From: latham@ablnc.ATT.COM (Ken Latham) Newsgroups: comp.unix.wizards Subject: Re: /bin/test and stat(2) Message-ID: <336@ablnc.ATT.COM> Date: Wed, 7-Oct-87 12:36:35 EDT Article-I.D.: ablnc.336 Posted: Wed Oct 7 12:36:35 1987 Date-Received: Sat, 10-Oct-87 17:46:33 EDT References: <9479@brl-adm.ARPA> <29056@sun.uucp> <467@ambush.UUCP> <743@quacky.UUCP> Organization: AT&T, Maitland, Florida Lines: 25 Summary: a more direct method > > >Don't rely on *this* behavior either, check that a string isn't null before > > >handing it to "/bin/test"! > > > >Just how ? Write a specialized c-program "isnull"....er! > > You can use the -a (boolean "and" operator) or -o ("or"). That is > > test " $name" != " " -a -d "$name" > The most direct ( and simplest complete ) method I know of is : test -n "${name}" -a -d "${name}" -n --- test if a string is NOT zero length. -z --- test if a string IS zero length. Don't let the {}'s get to you, they just delineate the variable name. Ken Latham AT&T Support ..!ihnp4!ablnc!latham