creating pipes in find(1)

Erik E. Fair fair at dual.UUCP
Tue Oct 2 13:31:27 AEST 1984


>> From: tcs%usna.uucp at BRL-BMD.ARPA
>> Newsgroups: net.unix
>> Subject: creating pipes in find(1)
>> Date: Tue, 25-Sep-84 11:51:16 PDT
>> 
>> How do I build a pipe within the exec portion of find?
>> Example:
>> 	find /etc -name printcap -exec cat {} | lpr \;
>> 
>> I've tried lots of combinations of escaped parens, exec'ing
>> the shell, etc and nothing works.
>> I have gotten this to work:
>> 	find /tmp -name tobuy -exec junk1 {} \;
>> 
>> junk1:
>> 	cat $1 | more
>> 
>> But I'd rather know how to do it without having another file
>> lying around.
>> 
>> If it can be done, please explain the combination of
>> escapes, etc you use make it work.  Thanks.
>> 	-tcs
>> 	Terry Slattery	  U.S. Naval Academy	301-267-4413
>> 	ARPA: tcs at brl-bmd     UUCP: decvax!brl-bmd!usna!tcs

I think what you want is something like this:

find / -perm -4000 -exec ls -ls {} \; | Mail -s "Daily SUID Program Report" root

Note the escaped semi-colon? That's part of the argument list to find(1).
That's what terminates an exec list. Since the semi-colon is escaped,
the shell (whichever one you use) will not use it to terminate the command.
Clear?

	Erik E. Fair	ucbvax!fair	fair at ucb-arpa.ARPA

	dual!fair at BERKELEY.ARPA
	{ihnp4,ucbvax,hplabs,decwrl,cbosgd,sun,nsc,apple,pyramid}!dual!fair
	Dual Systems Corporation, Berkeley, California



More information about the Comp.unix mailing list