l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2004 Apr 28 12:25

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Bash scripting newbie - need syntax help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Bash scripting newbie - need syntax help

On Wed, Apr 28, 2004 at 11:14:14AM -0700, Dave Margolis wrote:
> i agree, find is recursive by nature.  no need to account for recursion 
> with a script.  question:  how does piping ot xargs differ from using 
> the -exec switch of find?

Say you had files "deleteme", "metoo" and "imouttahere"

  find . -type f -exec rm {} \;

would cause this to happen:

  rm deleteme
  rm metoo
  rm imouttahere

whereas the xargs method:

  find . -type f | xargs rm

would cause this:

  rm deleteme metoo imouttahere

A bit quicker; less process forking, yada-yada-yada.

Now, why do that instead of just typing that "rm" by hand (or using
wildcards)?  Well, see the first post in this thread! :^)
(i.e., bash complaining about too many arguments)

Mike Simons taught me this one.  But then again, he taught me about 50% of
what I know. ;)

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!