On 03/01/07, Norman Gaywood <[EMAIL PROTECTED]> wrote:

But why are we we trying to pipe output to xargs. We are only dealing
with one name.


Or zero. I used the "xargs -r" trick to avoid running anything if there is
no output from readlink.

Whats wrong with just:

   rm -rf "$(readlink link)"


Should that not deal with special characters? Seems to work for spaces
and " in my tests.


Looks like you are right and the entire xargs trick is redundant - "rm -rf"
without an argument will apparently exit silently without doing anything,
and because you don't use back-quotes, which "flatten" the output
(converting newlines to spaces), it also works with white space and newline
characters in the link content.

As said before - you learn something new every day.

--Amos
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to