Hello All,

Something that really puzzles me. I got a neat script here from a fellow monk "nothingmuch" that works great to write a new line in another cgi script. The script that gets written to is originally chmod (ed) rwx-r x-r x, (755). However - once the script gets written to the chmod has become rw -r -r , that is, all the "executes" have been removed from the permissions and the original script will not run again till I go back to my host server and change it back manually. The code is below. Anyone know how to fix this?? Thanks so much for looking.....

#!/usr/local/bin/perl use CGI ':standard'; print "Content-type: text/html\n\n"; open (FILE,"writeline.cgi"); open (TEMP,">external_file.txt.tmp"); my $i = 0; while (<FILE>) { if ($i == 13){ $_ = "\$pageFile=\"webpage.html\";\n" if ($i == 13); } print TEMP $_; } continue { $i++; } close FILE; close TEMP; unlink ("write.cgi"); rename ("external_file.txt.tmp","writeline.cgi");

edited: Wed Oct 16 15:54:58 2002 by jeffa - code tags s/<br>//g


In reply to chmod changes on server when script runs by Donnie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.