shell (bash) script help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kuthi123
    Confirmed User
    • Jan 2005
    • 6478

    #1

    shell (bash) script help

    I am looking for a shell script (using SSH or telnet access) to mass overwrite files (using ./overwrite.sh ) on my server.
    for example, I have 100 domains on my server, and each of my server has 10 sub folders under public_html . each sub folder has example.php file and they are having some wrong code.i want to edit the code with new code..
    i want shell script should overwrite example.php with new code on all domains all sub folders.Any help here?
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55679

    #2
    smokey had something like this
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

    Comment

    • Peacemaker
      Confirmed User
      • Feb 2002
      • 897

      #3
      #!/bin/bash

      path="/htdocs/users/*/public_html/example.php"
      for a in `ls $path`; do
      perl -pi -e "s/OLDTEXT/NEWTEXT/goi" $a
      done






      you have to enter the right path.. cant exactly see how your folders / domains are structured .. should work. havent tested it :}
      Last edited by Peacemaker; 12-05-2006, 06:57 PM.
      SEO since 2002 - Google Index Record: 32 minutes. - Selling SEO services and tools

      Comment

      • kuthi123
        Confirmed User
        • Jan 2005
        • 6478

        #4
        thanks peace maker i will try.

        Comment

        • Peacemaker
          Confirmed User
          • Feb 2002
          • 897

          #5
          no problem. if you need help. let me know.
          SEO since 2002 - Google Index Record: 32 minutes. - Selling SEO services and tools

          Comment

          • PHP-CODER-FOR-HIRE
            Confirmed User
            • Nov 2006
            • 1090

            #6
            Get in touch with me and I'll code it specifically for your needs.

            Comment

            Working...