• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trailing LFs in shell scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trailing LFs in shell scripts


  • Subject: Re: Trailing LFs in shell scripts
  • From: John W Baxter <email@hidden>
  • Date: Tue, 19 Nov 2002 19:15:41 -0800

At 18:59 -0800 11/17/2002, Randal L. Schwartz wrote:
>>>>>> "Philip" == Philip Aker <email@hidden> writes:
>
>Philip> On Saturday, Nov 16, 2002, at 18:47 US/Pacific, Axel Luttgens wrote:
>>> And a file just consisting of sequence "abc" is just a malformed
>>> text file.
>
>Philip> I don't think that's strictly true. I believe unix tools also consider
>Philip> EOF and possibly EOS as a valid terminator. That's what all the
>Philip> beginner C lessons would have one account for.
>
>No. A "unix tool" will read to "end-of-file", which is not indicated
>by anything *in* the file, but rather by the meta information in the
>inode. The bytes "abc" would be a completely valid file, although
>many tools will probably rewrite it to "abc\n" if they are working
>in a line-oriented fashion.

Time to go off list. ;-)

Not tacking a trailing newline onto the last "line" in a file is a great
way to have that line missed. (In a far wider context than old Perl
versions ;-))

On the systems I drive (oldish BSDi, oldish and newish Linux), hosts.allow
and hosts.deny and crontab are examples of such files. I tend to put a
comment at the ends of configuration files these days, saying to put new
stuff above this line. It doesn't matter whether THAT has a trailing
newline or not...it's ignored either way. I did the crontab error most
recently within the last month.

--John (whose global deny at the end of hosts.deny once failed to deny
anything for want of a newline...fortunately I tested and was merely
confused for a while...my normal state anyhow)
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Trailing LFs in shell scripts
      • From: Philip Aker <email@hidden>
References: 
 >Re: Trailing LFs in shell scripts (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: applescript-users digest, Vol 3 #1075 - 17 msgs
  • Next by Date: unix shell encryption routine
  • Previous by thread: Re: Trailing LFs in shell scripts
  • Next by thread: Re: Trailing LFs in shell scripts
  • Index(es):
    • Date
    • Thread