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: Shell script - is this expected behaviour?


Nellis, Kenneth wrote:
From: Eric Blake
Never feed 'read' unterminated input.  Always end your text files
with a newline.

When I can't control the contents of the input file, I pipe it through a filter program I wrote that adds a final newline where the last character of a stream is not a newline.

I don't have the time to experiment at the moment, but I'm pretty sure that some of the standard tools append a line terminator if it's not already on the last line of their input. sed or awk or gawk, maybe? Anyway, if you can stumble on such a program, it can save you having to write and maintain and distribute a filter to all your environments.

--
Tim McDaniel

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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