[Techtalk] re: Joining commands together in bash

Telsa Gwynne hobbit at aloss.ukuu.org.uk
Mon May 12 12:54:47 EST 2003


On Mon, May 12, 2003 at 03:25:23AM -0700 or thereabouts, Berenice wrote:
> >file * | grep 'shell script text executable' | cut -f1 -d':' | xargs \
> >head -n 3
> 
> This is the first time I've seen the xargs command. It's quite handy!

(I added the \ because it now won't fit on one line: I think that's
the right way to say "continues"..?)

xargs is especially useful used in conjunction with find.

(Although it's always worth running the find without the "when
you've got it, do this thing" part added first, just in case
you have matched more than you thought... :)) 

Telsa


More information about the Techtalk mailing list