Date: Mon, 7 Dec 2015 11:07:40 -0800 From: Garrett Cooper <yaneurabeya@gmail.com> To: Ian Lepore <ian@freebsd.org> Cc: Warner Losh <imp@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r291929 - head/tools/tools/nanobsd Message-ID: <5FA6DD6B-C70B-4E5A-BD04-5897B02E5FC8@gmail.com> In-Reply-To: <1449512013.1358.6.camel@freebsd.org> References: <201512071024.tB7AOcjr094296@repo.freebsd.org> <1449512013.1358.6.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Dec 7, 2015, at 10:13, Ian Lepore <ian@freebsd.org> wrote: >=20 >> On Mon, 2015-12-07 at 10:24 +0000, Warner Losh wrote: >> Author: imp >> Date: Mon Dec 7 10:24:38 2015 >> New Revision: 291929 >> URL: https://svnweb.freebsd.org/changeset/base/291929 >>=20 >> Log: >> Make sure to quote the arg after -n and -z tests. >=20 > While I am generally a quoting fanatic and would much rather overquote > than underquote in shell scripts, fyi it's not actually needed for the=20 > -n and -z tests. test(1) and shells seem to be smart enough to see the > ']' (which is just an arg to test, not shell language syntax) and know > there isn't a string in front of it. Warner's commit was good. There's a more bulletproof way to do this to make i= t more portable (in most cases, not all), but it would be overkill: [ "x$x" !=3D x ] Also, his commit protects against variables with spaces in them doing unexpe= cted things with test(1). Thanks, -NGie=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5FA6DD6B-C70B-4E5A-BD04-5897B02E5FC8>