From owner-freebsd-questions@freebsd.org Sun Aug 6 13:31:41 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCE31DD9EC7 for ; Sun, 6 Aug 2017 13:31:41 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mailrelay12.qsc.de (mailrelay12.qsc.de [212.99.163.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.antispameurope.com", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FA2C1350 for ; Sun, 6 Aug 2017 13:31:40 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de ([213.148.129.14]) by mailrelay12.qsc.de; Sun, 06 Aug 2017 15:31:32 +0200 Received: from r56.edvax.de (port-92-195-203-176.dynamic.qsc.de [92.195.203.176]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 828603CBF9; Sun, 6 Aug 2017 15:31:31 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id v76DVUqh002072; Sun, 6 Aug 2017 15:31:30 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sun, 6 Aug 2017 15:31:30 +0200 From: Polytropon To: Manish Jain Cc: "freebsd-questions@freebsd.org" Subject: Re: Is quoting necessary in /etc/rc.conf ? Message-Id: <20170806153130.1dbcefd0.freebsd@edvax.de> In-Reply-To: References: Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-cloud-security-sender: freebsd@edvax.de X-cloud-security-recipient: freebsd-questions@freebsd.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mailrelay12.qsc.de with DD62F6A35D6 X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=1, IP=213.148.129.14 X-cloud-security: scantime:.1294 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2017 13:31:41 -0000 On Sun, 6 Aug 2017 11:00:03 +0000, Manish Jain wrote: > On my system, it works whether I put either of the following in rc.conf: > > xyz_enable="YES" > > Or, > > xyz_enable=YES > > Just wished to check whether an unquoted YES is completely equivalent > (and accepted) as a quoted YES ? Keep in mind /etc/rc.conf is basically a sh script. So the quoting rules of sh apply, and especially for the values YES and NO, it's completely equivalent. The general form is NAME=VALUE, and if VALUE contains spaces, quoting is needed, except you escape spaces. So foo_enable=YES is totally valid (no spaces), while both foo_flags="bar baz" and foo_flags=bar\ baz is valid as well (with spaces). If VALUE contains the $ sign or other special characters that might cause interpretation by /bin/sh at "parsing time", using the single quotes is possible: foo_currency='US$' For empty values, using foo_flags="" instead of foo_flags= looks "more logical", as "the empty value" can clearly be seen, instead of just missing the right-hand side of the association. In order to avoid confusion, using quotes for all arguments is suggested as per /etc/defaults/rc.conf ("system standard"), and this consistent form - even for the values that don't _require_ quotes, provides a clean view of that configuration file. That said, sticking with the "system standard" is never wrong. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...