[Cialug] find it already!

Zachary Kotlarek zach at kotlarek.com
Sun May 25 12:26:50 CDT 2008


On May 25, 2008, at 9:44 AM, Todd Walton wrote:

> On Sat, May 24, 2008 at 11:50 PM, Zachary Kotlarek  
> <zach at kotlarek.com> wrote:
>> You mean:
>>       find `pwd` -regex '*' -print
>>
>> Your shell expands * to match all files in the current directory,  
>> which is
>> probably not what you mean.
>
> You're right.  But now I try that and it doesn't return anything at
> all.  I'm in a directory with files.  Shouldn't the regex * return
> everything?

No, that would be:
	find `pwd` -regex '.*' -print
In regex an asterisk specifies a number of repeats -- 0 or more -- for  
the preceding pattern. You still need a pattern if you intend to  
actually match something.

But at least in my version of `find` you can just do this:
	find `pwd` -print
or even:
	find `pwd`
to get exactly the same output. And if you don't need absolute paths,  
you can even just call:
	find
with no arguments at all. The last version has the advantage of being  
shell-safe; the output from `pwd` in the others could contain  
whitespace or shell meta-characters.

	Zach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1682 bytes
Desc: not available
Url : http://cialug.org/pipermail/cialug/attachments/20080525/59bd4be1/smime.bin


More information about the Cialug mailing list