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

der.hans PLUGd at LuftHans.com
Thu Oct 21 13:20:59 MST 2010


Am 21. Oct, 2010 schwätzte Hunter Kreie so:

> 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
>
> This will handle files with spaces in them and gives you more flexibility with the input list. For instance, if you have a bunch of subdirectories, you could use find instead.

You're correct, my loop has problems with files that have spaces in the
name.

Your loop is better for a standalone task like this.

ciao,

der.hans
-- 
#  http://www.LuftHans.com/        http://www.LuftHans.com/Classes/
#  "The purpose of IT is to seamlessly and transparently provide the other
#  9/10's of the iceberg for people who need to work with chunks
#  of floating ice." -- Strata Rose Chalup


More information about the PLUG-discuss mailing list