This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: end of file characters

> I went with the defaults when installing cygwin.  Which means I used
>  the recommended unix/binary line feed setting.  It sounded like that
>  means I get no line-ending translation done by cygwin, which is fine.
> So I open a .bat file and see a bunch of ^Ms at the end of each line.
>   Then I open a xml file and don't see them.  I was expecting to see
> the
>  ^Ms again as the xml file, just like the bat file, was created in a
>  windows environment.  Is this normal?

Even within the Windows environment if often happens that files don't
have cr-lf line endings.  This is especially the case, for example, when
you have saved the file from the internet.  And even if you've edited
the file using a Windows editor, they quite often sense the line ending
format and write the file back using the same format.  So, yes, it is
possible that you may see .bat files with Ctrl-M's and .xml files
without them.

> Another question...  When I'm editing a file that has the ^Ms do I
>  leave them alone, or delete them?  Will I be able to go back and forth
> and
>  use vi via cygwin, and notepad/textpad via windows without harming the
>  file?

In general, you don't really need to delete Ctrl-M's, so long as the
files are working fine as they are.  Vi happily reads and writes files
with lines with or without Ctrl-M's.  You'll find that Notepad is
useless in editing files without Ctrl-M's, because it treats them as one
long line.  But WordPad works fine.

If you must delete the additional Ctrl-M's, don't do it by hand within
an editor, you may accidentally leave one in, which may potentially
later confuse the hell out of an editor, or you.  Use a program like
unix2dos/dos2unix to do that work for you.  

Peter K.
 Peter Klavins                                              Datalon SrL

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]