• 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: Using 'echo' from 'do shell script'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using 'echo' from 'do shell script'


  • Subject: Re: Using 'echo' from 'do shell script'
  • From: Philip Aker <email@hidden>
  • Date: Sun, 19 May 2002 05:26:44 -0700

On Saturday, May 18, 2002, at 11:54 AM, Matthew Stuckwisch wrote:

...then I will get a naughty newline. It would seem that this is an inconsistency that should be addressed because some shell tools like 'sort' don't have a -n option.

Agree?

Much so. Is strange this very :P


Greetings Bill and Matthew,


Bill Fancher has set me straight on the theory[1] of this via personal post and I have figured out the oddity[2] that is occurring with BBEdit.

[1] AppleScript does not know about files that a shell writes. It only knows to strip the last linefeed from what 'do shell script' returns. Thus in order to mix data from a script (with Mac standard '\r') to output files from the shell, there will usually have to be some kind of pipe or a tool option involved.

[2] BBEdit (I guess) is making the assumption as to what a file's eol characteristics are based on the first one it encounters. In the "short" file with bytes "joe\r\n" it sees a CRLF and assumes it is a DOS file and renders it as such. In the "long" file with bytes "joe\rjoe\r\n", because the first eol is a '\r', it assumes a Mac file and renders the '\n' as a glyph-less character. That's why I couldn't see the '\n' in the short file.



Thanks to both of you.


Best wishes,


Philip Aker
http://www.aker.ca
_______________________________________________
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.

References: 
 >Re: Using 'echo' from 'do shell script' (From: Matthew Stuckwisch <email@hidden>)

  • Prev by Date: Re: osascript - path to me
  • Next by Date: Re: alias as string = as Unicode text?
  • Previous by thread: Re: Using 'echo' from 'do shell script'
  • Next by thread: Re: osascript - path to me
  • Index(es):
    • Date
    • Thread