Date: Tue, 11 Jun 2013 11:56:41 +0200 From: Jan Henrik Sylvester <me@janh.de> To: Devin Teske <dteske@FreeBSD.org> Cc: questions-list freebsd <freebsd-questions@freebsd.org> Subject: Re: Bourne shell "if" syntax Message-ID: <51B6F459.5050306@janh.de> In-Reply-To: <121b01ce660e$2abae5f0$8030b1d0$@freebsd.org> References: <51b620a6.42f.2b6a6400.5605dcf0@go2france.com> <121701ce660c$9a9aa5b0$cfcff110$@freebsd.org> <51B62389.5000500@tundraware.com> <121b01ce660e$2abae5f0$8030b1d0$@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 06/10/2013 21:10, dteske@freebsd.org wrote: > Character sentinels are not required. > > FreeBSD's sh(1) knows (because "[" is a built-in) that when you quote a > parameter, that it is not (even if the value begins with "-") not an operator. What you are saying here is at least misleading. I just started up sh on 9.1 RELEASE and tried: $ A=-z $ if [ "$A" "" ] ; then echo z ; fi z $ if [ "$A" "1" ] ; then echo z ; fi $ if /bin/[ "$A" "" ] ; then echo z ; fi z $ if /bin/[ "$A" "1" ] ; then echo z ; fi $ Although "-z" is quoted, it is seen as an operator. It does not seem to have anything to do with whether the build-in or external "[" is used. Cheers, Jan Henrik
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51B6F459.5050306>