Hi,
I need to add the line:
#!/usr/local/bin/php
to the beginning of a bunch of PHP files in several directories. Is there a SED command that can do this?
Thanks,
Roy
My hosting provider (www.aldenhosting.com) sent me this:
fix_php() {
chmod -v 551 $file # Make them executable
if [ `grep -c '/usr/local/bin/php' $file ` -eq 0 ]
then
echo "No /usr/local/bin/php found in file $file I am adding
it to the top of file";
echo '#!/usr/local/bin/php' > web.tmp
cat $file >> web.tmp
cp --force web.tmp $file
fi
}
# This calls the above fix_php for each file in html diretcory
for file in ` find /webs/web_q9/q9asdfgh/html -name '*.php' `
do
fix_php
done :wink:
Bookmarks