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 _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
