Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.8 $; site ccvaxa Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!mtuxo!drutx!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!preece From: preece@ccvaxa.UUCP Newsgroups: net.unix-wizards Subject: Re: In sh, is '[' a portable synony Message-ID: <2000031@ccvaxa> Date: Mon, 21-Oct-85 13:06:00 EDT Article-I.D.: ccvaxa.2000031 Posted: Mon Oct 21 13:06:00 1985 Date-Received: Wed, 23-Oct-85 06:24:33 EDT References: <313@bdaemon.UUCP> Lines: 25 Nf-ID: #R:bdaemon.UUCP:-31300:ccvaxa:2000031:000:878 Nf-From: ccvaxa.UUCP!preece Oct 21 10:06:00 1985 > ... the [ condition ] construct saves only one keystroke at the > expense of readability. E.g.: > > if test -f "$1" <= 15 keystrokes + > vs. > if [ -f "$1" ] <= 14 keystrokes + > > Which is more readable? Note that the spaces around [] are MANDATORY. > /* Written 9:57 am Oct 15, 1985 by carl@bdaemon.UUCP in > ccvaxa:net.unix-wizards */ ---------- Well, readability is very much in the eye of the beholder. I much prefer the second form, which I gather you think is less readable. The test part is bracketed. The syntax is closer to C. The word "test" has been turned into a symbol, which is generally a good thing [flamers please note and respect that "generally"]. Now, if you wanted to substitute words for the test names, I'd be right with you. "-f" doesn't suggest anything to me... -- scott preece gould/csd - urbana ihnp4!uiucdcs!ccvaxa!preece