Date: Mon, 16 Jul 2001 12:03:25 -0400 From: parv <parv_@yahoo.com> To: Andreas Klemm <andreas@FreeBSD.ORG> Cc: freebsd-stable@FreeBSD.ORG Subject: of shell, find, and (g)xargs (Re: mass uninstall all ports?) Message-ID: <20010716120325.A1149@moo.holy.cow> In-Reply-To: <20010716084129.A504@titan.klemm.gtn.com>; from andreas@FreeBSD.ORG on Mon, Jul 16, 2001 at 08:41:29AM %2B0200 References: <20010712182844.A26646@moo.holy.cow> <20010712224021.95596.qmail@web13502.mail.yahoo.com> <20010712191017.B29406@moo.holy.cow> <20010716084129.A504@titan.klemm.gtn.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010716120325.A1149>