Re: using echo 'text' > file (to add to last line of several…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Dale Farnsworth
Date:  
To: plug-discuss
CC: 
Subject: Re: using echo 'text' > file (to add to last line of several documents)
> 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
---------------------------------------------------
PLUG-discuss mailing list - 
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss