From owner-freebsd-rc@FreeBSD.ORG Mon Oct 15 16:29:17 2012 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F0FE0C33; Mon, 15 Oct 2012 16:29:16 +0000 (UTC) (envelope-from mmakonnen@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 896278FC17; Mon, 15 Oct 2012 16:29:15 +0000 (UTC) Received: by mail-bk0-f54.google.com with SMTP id jf20so2455542bkc.13 for ; Mon, 15 Oct 2012 09:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=K+PmAWI21Q9X4IpqP2F0aE7XCj7uHVMo+GgHW0yi4VQ=; b=VuRncBNznEc0xidZZd0Nf6qb7X1j+4Vr8KdssJvnNdSOYvPDpLKa1POZrn75a8Jadd 71beq6CqBZvlgURygSfPYm1UTrjNiP0WapZWGXSuJIkbCDfW2gXZmu/vF0HURfmpdizY tUeBzisFL+oRc0Rm5enO2AJvXXV1lV3b1wvTQaS+K1+yvQcy8F6myp1+WoOF55AtLgMp isAxcsgN1C1XR0GRALXGMYGWufw5gi7uqtflqS57OPMxP6fXlCiqgUs++2ZqgEfQWgCQ IIMUJ0mEHB6RfJP4eznsCWKtP/IaSNUm6155NfRaxKg0KF0o9QkVcPIY+Ou+EJ8oq/mY qR2g== Received: by 10.204.156.74 with SMTP id v10mr3360483bkw.39.1350318554320; Mon, 15 Oct 2012 09:29:14 -0700 (PDT) Received: from [192.168.8.158] ([213.55.110.254]) by mx.google.com with ESMTPS id k21sm9008882bkv.1.2012.10.15.09.29.07 (version=SSLv3 cipher=OTHER); Mon, 15 Oct 2012 09:29:09 -0700 (PDT) Message-ID: <507C39D0.9030909@gmail.com> Date: Mon, 15 Oct 2012 19:29:04 +0300 From: Michael Telahun Makonnen User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: crees@FreeBSD.org Subject: Re: docs/172692: [PATCH] Bring parts of the rc scripting guides up to date References: <201210141319.q9EDJN6H085443@freefall.freebsd.org> In-Reply-To: <201210141319.q9EDJN6H085443@freefall.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-doc@FreeBSD.org, freebsd-rc@FreeBSD.org, freebsd-bugs@freebsd.org X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2012 16:29:17 -0000 Some minor nits: @@ -479,7 +479,7 @@ The names of all &man.rc.conf.5; variables used exclusively by our script must - have the same prefix: ${name}. For + have the same prefix: ${name}_. For example: dummy_mode, dummy_state_file, and so on. You should add the same correction to the very next sentence, which reads: Note: While it is possible to use a shorter name internally, e.g., just msg, adding the unique prefix ${name} to all global names introduced by our script will save us from possible collisions with the rc.subr(8) namespace. @@ -491,15 +491,6 @@ our script will save us from possible collisions with the &man.rc.subr.8; namespace. - As long as an &man.rc.conf.5; variable and its - internal equivalent are the same, we can use a more - compact expression to set the default value: - - : ${dummy_msg:="Nothing started."} - - The current style is to use the more verbose form - though. - Not sure why you felt this paragraph needed to be removed. @@ -512,7 +503,11 @@ Here we use dummy_msg to actually - control our script, i.e., to emit a variable message. + control our script, i.e., to emit a variable message. + Use of a shell function is overkill here, since it only + runs a single command; an equally valid alternative is: + + start_cmd="echo \"$dummy_msg\"" While you are technically correct, I think you misunderstood the writer's intent, which was to show how an rc.conf(8) variable can be used in a subroutine to control the behavior of the command. I agree that the example isn't a very good one (in that it doesn't depict a valid use case), but I think the "spirit" is correct. Maybe you can suggest a better example? Cheers, Mike.