rm - Argument list too long
RW
list-freebsd-2004 at morbius.sent.com
Sun Jan 29 04:35:53 PST 2006
On Sunday 29 January 2006 03:27, Bill Campbell wrote:
> On Sat, Jan 28, 2006, Kirk Strauser wrote:
> >On Friday 27 January 2006 17:52, Paul Schmehl wrote:
> >> for files in *.*
> >> do
> >> rm $files
> >> done
> >
> >Don't ever, *EVER* blindly unlink glob expansions. It's bad for you.
> >
> >Instead, use something like:
> >
> > find . -name 'sess.*' -delete
>
> While that's good advice, it doesn't answer the question of argument list
> too long.
Yes, it does.
The glob is expanded by find, the "argument list too long" problem occurs when
the glob is expanded by the shell.
> The short answer is read ``man xargs''.
>
> find . | xargs command
That should be:
find . -print0 | xargs -0 command
In FreeBSD null termination is needed to handle names with spaces, and not
just the rare problem of names containing newlines. It's easier to just use
find with the ls, delete and exec[dir] options.
More information about the freebsd-questions
mailing list