Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!nsc!nsta!instable!amos From: amos@instable.UUCP Newsgroups: comp.bugs.4bsd Subject: Re: Bug/Feature in `test' - (nf) Message-ID: <738@instable.UUCP> Date: Sun, 5-Apr-87 04:53:31 EST Article-I.D.: instable.738 Posted: Sun Apr 5 04:53:31 1987 Date-Received: Sun, 5-Apr-87 23:48:59 EST References: <6200001@iaoobelix.UUCP> <256@quacky.mips.UUCP> Reply-To: amos%nsta@nsc.com (Amos Shapir) Distribution: world Organization: National Semiconductor (Israel) Ltd. Lines: 26 Hdate: 6 Nisan 5747 In article <256@quacky.mips.UUCP> dce@quacky.UUCP (David Elliott) writes: >In article <6200001@iaoobelix.UUCP> wagner@iaoobelix.UUCP writes: >>The file `try' contains the following: >> >> #! /bin/sh >> if [ "$1" = "-d" ] >> then >> echo ok >> fi Problems with 'test' aside, you can avoid using it altogether by doing: case "$1" in -d) echo ok ;; *) echo bad ;; esac 'case' is builtin while test (a.k.a. '[') usually isn't, and it also interprets flags in its own way. The 'case' syntax is a little more complicated, but if string comparison is all you need, 'case' is the way to go. -- Amos Shapir National Semiconductor (Israel) 6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel Tel. (972)52-522261 amos%nsta@nsc.com {hplabs,pyramid,sun,decwrl} 34.48'E 32.10'N