Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Adding a line to a file
Results 1 to 2 of 2

Thread: Adding a line to a file

  1. #1
    Associate
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    13

    Adding a line to a file

    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

  2. #2
    Associate
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    13

    Re: Adding a line to a file

    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:

Similar Threads

  1. command line help
    By jan1024188 in forum Windows - General Topics
    Replies: 1
    Last Post: 01-10-2007, 09:48 AM
  2. Do I need a command line?
    By Kauno-Uolevi in forum Linux - General Topics
    Replies: 18
    Last Post: 08-17-2003, 03:47 PM
  3. Removing a line from a file
    By tolstoy in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 10-24-2002, 07:41 PM
  4. How can I remove a line in a file?
    By t048 in forum Linux - Software, Applications & Programming
    Replies: 10
    Last Post: 03-17-2002, 09:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •