yeah, I can't get that to work either. not sure why. so then my solution
would be:

touch blankfile; find -type f -exec cp blankfile {} \;

-wes

On Mon, Aug 15, 2011 at 4:18 PM, Jameson Williams <
[email protected]> wrote:

> That one doesn't work on my end. It echos (literally) lines like
> > filename
> instead of executing the above in bash.
>
>
>
>
> On 08/15/2011 04:15 PM, wes wrote:
>
>> My solution would have been:
>>
>> find -type f -exec echo "" \>  {} \;
>>
>> -wes
>>
>> On Mon, Aug 15, 2011 at 3:48 PM, Jameson Williams<
>> [email protected]>  wrote:
>>
>>  On 08/15/2011 03:47 PM, Sam Hart wrote:
>>>
>>>> On Mon, Aug 15, 2011 at 6:22 PM, Jameson Williams
>>>> <[email protected]>   wrote:
>>>>
>>>>> I haven't been able to get this one yet.
>>>>>
>>>>> Challenge: A one-line statement (pipes okay, but explicit loops not)
>>>>> that empties all found files (as for debugging with /var/log, perse).
>>>>>
>>>>> This is close, but has a loop:
>>>>>
>>>>>      find -type f | while read file; do :>$file; done
>>>>>
>>>>> This seems like it might work, but doesn't:
>>>>>
>>>>>      find -type f -exec cat /dev/null \>   {} \;
>>>>>
>>>> Seems like a silly question as there's *no* way to technically avoid
>>>> loops (even if you're not doing it in your line, the underlying code
>>>> is using a loop), but I'd probably use xargs and truncate:
>>>>
>>>> ls | xargs truncate --size=0
>>>>
>>>> Use find instead of ls if you want something more fancy like
>>>> recursion. Might be pretty fun to do as root on / :-)
>>>>
>>>>                                        ---Sam
>>>>
>>> Technically true regarding loops, although I feel they cheapen the
>>> aesthetic appeal of the one-liner. :-) I hadn't encountered truncate,
>>> that works great!
>>>
>>> Thanks,
>>> Jameson
>>>
>>> ______________________________**_________________
>>> PLUG mailing list
>>> [email protected]
>>> http://lists.pdxlinux.org/**mailman/listinfo/plug<http://lists.pdxlinux.org/mailman/listinfo/plug>
>>>
>>>  ______________________________**_________________
>> PLUG mailing list
>> [email protected]
>> http://lists.pdxlinux.org/**mailman/listinfo/plug<http://lists.pdxlinux.org/mailman/listinfo/plug>
>>
>
>
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to