From owner-svn-src-head@FreeBSD.ORG Wed Dec 19 21:59:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 195813AE; Wed, 19 Dec 2012 21:59:31 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) by mx1.freebsd.org (Postfix) with ESMTP id E2BB38FC14; Wed, 19 Dec 2012 21:59:30 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id CB2ED225C3; Wed, 19 Dec 2012 13:59:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1355954370; bh=DPLaYQvr7e54yNUHx+N99FmaPELCT/xedpwKrVRP0EM=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=hw04+fFBIJ2VQx6byR8FAFcEVy8XmgC2kdeLzJK+Jxf9FxzNNI6mb6CuNqIinS+mD AqcMf4ZMPuiZzZcUlzlca/zFYSG5GfRUczBvQmgFE+jmB+XmxrNIh7jbWcO9k7hZCi kvEJvghgr4+4MQMITF5C39Asw7iQBVB2lbPX3UwU= Message-ID: <50D238C1.2010803@delphij.net> Date: Wed, 19 Dec 2012 13:59:29 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Garrett Cooper Subject: Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl References: <201212132332.qBDNWmK4037503@svn.freebsd.org> <50D1D720.80206@FreeBSD.org> <1355931456.1198.203.camel@revolution.hippie.lan> <05CC5BAD-B968-4A7A-8097-A3344D970D63@mu.org> <1355932607.1198.206.camel@revolution.hippie.lan> <50D2128A.7030205@delphij.net> <20121219210418.GA83983@stack.nl> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 19 Dec 2012 22:24:45 +0000 Cc: Ian Lepore , "src-committers@freebsd.org" , d@delphij.net, Jilles Tjoelker , "svn-src-all@freebsd.org" , Alfred Perlstein , Xin LI , "svn-src-head@freebsd.org" , Andrey Zonov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 21:59:31 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 12/19/12 13:10, Garrett Cooper wrote: > On Wed, Dec 19, 2012 at 1:04 PM, Jilles Tjoelker > wrote: >> On Wed, Dec 19, 2012 at 11:16:26AM -0800, Xin Li wrote: >>> It may be worthy to make sysctl(8) to accept mutiple -f's, but >>> it seems to be hard to write shell scripts that utilizes this >>> feature in a elegant manner. >> >> This is possible but indeed a bit ugly. >> >> Hard-coding the list of files is not too bad: >> >> shift $# for _f in /etc/sysctl.d/* /etc/sysctl.conf >> /etc/sysctl.conf.local; do [ -r "$_f" ] && set -- "$@" -f "$_f" >> done sysctl "$@" >> >> If the list is passed in the positional parameters it becomes >> uglier: >> >> _first=1 for _f do [ -n "$_first" ] && shift $# _first= [ -r >> "$_f" ] && set -- "$@" -f "$_f" done sysctl "$@" >> >> This uses for's temporary storage of the words being iterated >> over, building a new set of positional parameters in the loop. >> >> An alternative is to append the new list to the old one and to >> use a saved copy of $# to remove the old elements afterwards. >> >> It would be nice to store the arguments in a variable but that is >> not possible because all characters are valid in pathnames, >> except the null character which cannot be used in shell either. > > find -exec / echo | xargs ? Seems like there's a better way to > solve this. Thanks, Won't work because you have to add -f's. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQ0jjBAAoJEG80Jeu8UPuzdRQH/AxNFRT1n+9aGQ7BuwHXSl5k aY+Em7+W7de4HRh2Xmkt66q64419HxgKBv45DBtcg35xEWIaDBNTgZ0JKfvG94eg mH43tq270sTuWJ1pZRIxybfLSPrP2uwsyG372Vw40AW2KdrWH1VZgKlTlmU8nF9G b/cnTa5BhD5r+35o2gsWIQT6j34hWGja9tOi4vgmAAMxDbgdL2sHE42R0Tex/Ydz hlRXAl+dMNqx9mw0rUwKdGBUFa5vDLokhI+AKCiAOMPxtUqheee1GqAytyEb0nst uZcF/cmBDoS5j/W7UGfLrlR6fSr0nxqjbIVr4VSa15aUCvEmW5oZ3HhRy+lZYM4= =5kx8 -----END PGP SIGNATURE-----