On Wed, Jan 03, 2007 at 04:10:45PM +1100, Amos Shapira wrote:
> On 03/01/07, Zhasper <[EMAIL PROTECTED]> wrote:
> >
> >Only because you're using the -0 flag.
>
>
> (This is also going to destroy the ability to handle whitespace in
> >filenames though, so you probably don't want to do this.)
>
>
> Correct on both accounts, but this is why I insist on using -0 whenever
> possible, especially when processing input to sensitive commands like rm,
> and bother adding the weird "echo -e".
But why are we we trying to pipe output to xargs. We are only dealing
with one name.
Whats wrong with just:
rm -rf "$(readlink link)"
Should that not deal with special characters? Seems to work for spaces
and " in my tests.
> Another "nul generator" could be
>
> perl -e 'print "\0"'
>
> instead of "echo -e \\0"
>
> or
>
> readlink -fe link | awk '{ print $0 "\0" }' | xargs -0r rm -rf
>
> and possibly other ways to achieve the same goal.
>
> --Amos
--
Norman Gaywood, Systems Administrator
University of New England, Armidale, NSW 2351, Australia
Please avoid sending me Word or Power Point attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html