Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2018 16:42:19 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Mark Felder <feld@FreeBSD.org>, Alexey Dokuchaev <danfe@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r334221 - head/etc
Message-ID:  <1528756939.12122.40.camel@freebsd.org>
In-Reply-To: <1528756176.557409.1404618352.33DD9A15@webmail.messagingengine.com>
References:  <201805251936.w4PJaQIf093393@repo.freebsd.org> <20180527060917.GA3179@FreeBSD.org> <1528756176.557409.1404618352.33DD9A15@webmail.messagingengine.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2018-06-11 at 17:29 -0500, Mark Felder wrote:
> 
> On Sun, May 27, 2018, at 01:09, Alexey Dokuchaev wrote:
> > 
> > On Fri, May 25, 2018 at 07:36:26PM +0000, Mark Felder wrote:
> > > 
> > > New Revision: 334221
> > > URL: https://svnweb.freebsd.org/changeset/base/334221
> > > 
> > > Log:
> > >   rc.subr: Support loading environmental variables from a file
> > >   
> > > +	if [ -n "$_env_file" ] && [ -r "${_env_file}" ]; then
> > Style bug: "$_env_file" vs. "${_env_file}".  Also, isn't the -n
> > check
> > redundant?
> The entire rc.subr file seems to be full of style inconsistencies.
> I'd take the time to fix it if there would be no objections. As per
> redundancy, it's copy+paste of what mat suggested. I suppose the -r
> will fail if the variable is not set, so it would indeed be
> redundant. I didn't think of it that way.
> 

That will work as long as there are quotes around the arg to -r:

    $ foo=""
    $ [ -r ${foo} ] && echo good
    good
    $ [ -r "${foo}" ] && echo good
    $ 

Same results if $foo is unset.

-- Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1528756939.12122.40.camel>