using echo 'text' > file (to add to last line of several documents)

Dale Farnsworth dale at farnsworth.org
Thu Oct 21 11:12:30 MST 2010


> Although the for loop will probably work for your PHP files, I generally
> prefer using a different method for processing lists of files.
> 
> /bin/ls *.php | while read i ; do echo "text" >> $i ; done

Using "while read" is a good idea but this still doesn't properly handle
filenames with spaces.  Try this instead:

	/bin/ls -1 *.php | while read i; do echo "text" >> "$i"; done


More information about the PLUG-discuss mailing list