Re: line breaks
| From: | Rodney Green | Date: | Tue, 25 Nov 2003 15:46:46 +0000 |
| Subject: | Re: line breaks | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170896@lists.php.net to get a copy of this message | ||
John Nichel wrote:
Rodney Green wrote: <snip>RodActually, I'm not having problems with that. The whitespace is still there in between the commands and arguments, etc. I'm using fgets , not fread. Not sure what the difference between the two is but I'll check it out. The problem I am having however is that at the end of the shell script that is created it puts an additional line. It writes the chown command line for all of the users then puts the following line with no user specified. chown :html /var/spool/mail/ The other lines show up as: chown rgreen:html /var/spool/mail/rgreen chown rgreen01:html /var/spool/mail/rgreen01 chown rod:html /var/spool/mail/rod Any ideas where that extra line is coming from? thanks again, RodIs there a carriage return (new line) after the last entry in your text file? You can add an if test in there to stop this... $buffer = rtrim ( $handle[$i] ); if ( $buffer != "" ) {fwrite ($fhandle, "chown $buffer:html /scripts/var/spool/mail/$buffer\n", 4096);} Thanks again, John. That was the problem and the if test fixed it.