From owner-freebsd-stable Mon Jul 16 8:59:43 2001 Delivered-To: freebsd-stable@freebsd.org Received: from mtiwmhc26.worldnet.att.net (mtiwmhc26.worldnet.att.net [204.127.131.51]) by hub.freebsd.org (Postfix) with ESMTP id 9FC2137B40A; Mon, 16 Jul 2001 08:59:31 -0700 (PDT) (envelope-from parv@worldnet.att.net) Received: from worldnet.att.net ([32.100.199.244]) by mtiwmhc26.worldnet.att.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20010716155928.KZVR2154.mtiwmhc26.worldnet.att.net@worldnet.att.net>; Mon, 16 Jul 2001 15:59:28 +0000 Received: by worldnet.att.net (Postfix, from userid 1001) id 926CB50B93; Mon, 16 Jul 2001 12:03:25 -0400 (EDT) Date: Mon, 16 Jul 2001 12:03:25 -0400 From: parv To: Andreas Klemm Cc: freebsd-stable@FreeBSD.ORG Subject: of shell, find, and (g)xargs (Re: mass uninstall all ports?) Message-ID: <20010716120325.A1149@moo.holy.cow> Mail-Followup-To: Andreas Klemm , freebsd-stable@FreeBSD.ORG References: <20010712182844.A26646@moo.holy.cow> <20010712224021.95596.qmail@web13502.mail.yahoo.com> <20010712191017.B29406@moo.holy.cow> <20010716084129.A504@titan.klemm.gtn.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010716084129.A504@titan.klemm.gtn.com>; from andreas@FreeBSD.ORG on Mon, Jul 16, 2001 at 08:41:29AM +0200 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG on Jul 16 11:29, i got this from Andreas... > On Thu, Jul 12, 2001 at 07:10:17PM -0400, parv wrote: > > ...in the end both will do the same thing: remove/delete all the > > installed software as listed in /var/db/pkg. if you go the 'pkg_info' > > route, you should add '-f' and or '-d' flag. > > > > if pkg_delete/xargs/shell complain that 'pipe broken', 'too many > > arguments', or some such, then you can try this... > > > > # find /var/db/pkg -type d -execdir pkg_delete -fd {} \; > > This forks a pkg_delete command for every port found, thats expensive. > Why not use find/xargs combination in this case as well ? > > ( cd /var/db/pkg; find . -type d | xargs pkg_delete ) > if you re-read my message i mentioned 'too many arguments' & 'xargs' & 'shell' in one sentence. so i came up w/ above 'find' command. that way 'too many arguments' or 'pipe broken' will be missed at the expense of extra fork, as you have noted. actually, i would have preferred this myself... # cd /var/db/pkg && ( find . -type d | gxargs -i pkg_delete -df {} ) ...but since freebsd's xargs doesn't support anything like gnu xargs' '-i' option and gxargs is a port (or, it's data would have existed under /var/db/pkg), that would haven not worked. at least not without mv'ing /var/db/pkg/findutils-* out of /var/db/pkg. -- so, do you like word games or scrabble? - parv To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message