[CentOS] OT -- BASH
Robert
kerplop at sbcglobal.net
Fri Jun 23 02:02:51 UTC 2006
Les Mikesell wrote:
>On Thu, 2006-06-22 at 07:21, Robert wrote:
>
>
>>Can someone explain why this:
>> find . -depth -print0 | cpio --null -pmd /tmp/test
>>will copy all files in and below the current directory -and- this:
>> find . -depth -print | grep -v .iso$ | wc -l
>>will count all the non-iso files -and- this:
>> find . -depth -print | grep .iso$ | wc -l
>>will count *only* the iso files -but- this:
>>find . -depth -print0 | grep -v .iso$ | cpio --null -pmd /tmp/test
>>doesn't copy *anything*?
>>Any suggestions for a work-around would also be most welcome.
>>
>>
>
>This doesn't have much to do with bash except that you
>could easily see the answer if you left off the last element
>of that last pipeline so you could see the output from
>grep. You are feeding grep one long line with null
>terminated filenames when it wants things one separate
>lines. You can let find do the selection:
>
>find . -depth ! -name '*.iso' -print0 | cpio ...
>but I'd probably:
>rsync -av --exclude '*.iso' . /tmp/test
>instead.
>
>
>
Thanks to all who replied and an apology for not acknowledging them
earlier. I had to leave almost immediately after posing the problem.
Aside from answering my questions, I'd say that 14 responses within
49 minutes of my original post is a testament to the helpful attitude
that characterizes this list.
Best regards
More information about the CentOS
mailing list