Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: $Revision: 1.6.2.16 $; site mirror.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!mirror!rs From: rs@mirror.UUCP Newsgroups: net.unix-wizards Subject: Re: Re: In sh, is '[' a portable synonym Message-ID: <13400016@mirror.UUCP> Date: Fri, 18-Oct-85 13:37:00 EDT Article-I.D.: mirror.13400016 Posted: Fri Oct 18 13:37:00 1985 Date-Received: Tue, 22-Oct-85 06:01:03 EDT References: <313@bdaemon.UUCP> Lines: 25 Nf-ID: #R:bdaemon:-31300:mirror:13400016:000:880 Nf-From: mirror!rs Oct 18 13:37:00 1985 /* Written 10:57 am Oct 15, 1985 by carl@bdaemon in mirror:net.unix-wizar */ /* ---------- "Re: In sh, is '[' a portable synony" ---------- */ > > > > On my 4.2bsd system, the following do the same thing in sh because > > /bin/[ is a link to /bin/test. ... Is the "[]" form safe to use if you want > > .... > > V7 systems where /bin/[ isn't a link to /bin/test. Any V7 or post-V7 system > can be made to support "if [ ]" as equivalent to "if test > ..... > GUy Harris I have absolutely no arguments with Guy's message, but would like to point out that 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. Carl Brandauer /* End of text from mirror:net.unix-wizar */