Appending new line characters to files

Justin Findlay jfindlay at gmail.com
Fri Mar 10 15:30:44 MST 2006


I'll change the subject too at least to spite gmail's Hello, World threading.

On 3/10/06, Hans Fugal <hans at fugal.net> wrote:
> This is a great usage of $() but you made the perfect world assumption
> of no spaces. Not really a safe assumption for a directory structure
> coming from windows. Here it is tweaked:
>
>     $ find . -name \*.cc -o -name \*.h | while read i; do echo >>${i}; done

This is a better solution than the one I proposed as it doesn't add a
newline to the end every file, just the ones gcc is interested in, and
because \* will match legal filename characters (including space).  My
previous trick doesn't since the "for i in $(expr)" doesn't work on a
null-terminated list even if "expr" itself produces a null-teminated
list.


Justin



More information about the PLUG mailing list