Robert Russell wrote:
>
> On Thu, Jan 29, 2009 at 4:34 PM, Angel Tsankov
>>
>> Should a shell script end in a new line character ('\n')?
>>
> What do you mean by end in a new line?

I'll explain with an example:

=== file1 ===
echo 'This is line one. It terminates in a line feed character'
echo 'This is line two.  It does not terminate in a line feed character'
== end of file1 ===

=== file 2 ===
echo 'This is line one. It terminates in a line feed character'
echo 'This is line two.  It terminates in line feed character'

== end of file2 ===

I'm asking if it's OK not to end a shell script in a line feed character 
(like file1).  This question is bothering me 'cause when I edit a shell 
script with vi and the last line in the file does not end in a line feed 
character, vi appends one to it.  I wonder what the reason for this might 
be.  In particular, is there any convention or standard that stipulates what 
the last character of a shell script should be or is this just vi's 
behaviour?

--Angel 

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to