• 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: Axel Luttgens <email@hidden>
  • Date: Sun, 17 Nov 2002 03:47:27 +0100

Philip Aker wrote:

On Thursday, Nov 14, 2002, at 09:49 US/Pacific, Paul Berkowitz wrote:

But it's that final trailing newline that shows up even when my internal
lineEnds are CR that bothers me:

[...]
do shell script "echo '" & txt & "' > \"" & utestPath & "\"" with altering
line endings -- one line


Even here, there's a trailing LF. Why?


do shell script "echo -n ...

-n in this context means the same as Tcl's -nonewline for 'puts' (don't output trailing newline).

Wow. Again an example of "shadow messages". Where exactly is Paul's message? Never received it.

That said, I would just add a general comment on this topic.
May prove useful, unless I'm completely wrong (in which case my usual apologizes apply).

I think that it is a unix convention to consider a text file as a stream of lines.
A line being a string (possibly empty) of characters ended by a linefeed.

So, an empty file is a file containing an empty text.
A file containing just a linefeed is a text consisting of an emtpy line.
And a file just consisting of sequence "abc" is just a malformed text file.

That is, since most unix commands expect either text on their standard input or to write text on their standard output, you get a great consinstency with such a convention (since a command is generally entered with an end of line too, notwithstanding specific shelll conventions).

Just a side note,
Axel
_______________________________________________
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: Entourage: Kill that Daemon! (Shell)
  • Next by Date: Re: [OT] Re: Entourage: Kill that Daemon! (Shell)
  • Previous by thread: Re: Trailing LFs in shell scripts
  • Next by thread: Re: Trailing LFs in shell scripts
  • Index(es):
    • Date
    • Thread