On 06/10/2013 21:10, dte...@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
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to