On Wednesday 13 September 2006 11:25, Andy Greenwood wrote:
> I need a CLI text editor I can use over ssh, which does NOT append
> newlines to the end of files as I save them. I am using this to edit
> PHP files, and my PHP doesn't like newlines outside the last ?>. ee
> and vi both do so, I tried nano which also does the same. I haven't
> installed emacs to try that yet, since the man page says that it also
> does the same thing. Does anyone have any ideas?

"vim -b brokenfile.php" should work.  Note that something is seriously broken 
with PHP, though, if it can't process text files in the standard format.

> Another question: Why do so many text editors have this behavior?

Because lines end with end-of-line, and the last line isn't magic.  Note that 
almost every text file on your system is this way.  Try this:

   $ cat somefile.txt; echo NEWTEXT

If somefile.txt contains "foo", you'd expect to see:

   foo
   NEWTEXT

However, your broken PHP install insists on files that would result in:

   fooNEWTEXT

which is clearly not the right thing to do.  I really don't mean to sound 
harsh, but the problem really is with PHP and not your text editors.  If that 
was a widespread issue, you'd hear about it all over the place and not just 
in this one thread.
-- 
Kirk Strauser

Attachment: pgpADrhTHnrju.pgp
Description: PGP signature

Reply via email to