Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sdcsla.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!bbnccv!bbncca!wanginst!decvax!ittatc!dcdwest!sdcsvax!sdcsla!west From: west@sdcsla.UUCP (Larry West) Newsgroups: net.unix-wizards Subject: Re: Re: In sh, is '[' a portable synonym Message-ID: <1016@sdcsla.UUCP> Date: Tue, 29-Oct-85 17:43:52 EST Article-I.D.: sdcsla.1016 Posted: Tue Oct 29 17:43:52 1985 Date-Received: Sat, 2-Nov-85 05:26:25 EST References: <313@bdaemon.UUCP> <13400016@mirror.UUCP> Reply-To: west@sdcsla.UUCP (Larry West) Organization: UC San Diego: Institute for Cognitive Science Lines: 33 Summary: Make sure that's "/bin/test" > > if test -f "$1" <= 15 keystrokes +> vs. > if [ -f "$1" ] <= 14 keystrokes + > > Which is more readable? Note that the spaces around [] are MANDATORY. I don't really know which is more readable (though I wonder why the author was confusing this with the number of keystrokes -- redundancy often aids readability, and in particular the spaces around [] are helpful). However, I would like to point out that users have a habit of naming programs "test", and of having "/bin" occur late in their paths. This tends to cause confusion because the problem (as usual) doesn't come up until that brief "test" program has been forgotten. So, my suggestion is to always use "/bin/test" instead of simply "test", or else use "[ ]". I know, fixing the the particular pathname of a program is a bad idea, but this seems a fairly safe case (unless you plan to provide an improved user interface to "test":-). -- Larry West (USA+619-)452-6771 Institute for Cognitive Science non-business hours: 452-2256 UC San Diego (mailcode C-015) La Jolla, CA 92093 U.S.A. ARPA: or UUCP: {ucbvax,sdcrdcf,decvax,ihnp4}!sdcsvax!sdcsla!west or {sun,mplvax,gti,ihnss,whuxlb,ulysses}!sdcsla!west