Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
- Subject: Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 28 Feb 2008 18:50:59 -0800
- Thread-topic: linebreak in a shell script; was Re: What's wrong with this call to zip?
Title: Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
On 2/28/08 6:03 PM, "Philip Aker" <email@hidden> wrote:
On 08-02-28, at 15:57, Shane Stanley wrote:
set x to "blah" & return & linefeed & "blah"
count of characters of x --> 9
character 5 of x --> in Script Debugger, "\r\n"
id of character 5 of x --> {13, 10}
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {linefeed}
count of text items of x --> 1
set AppleScript's text item delimiters to oldDelims
(The result is the same if you use ASCII character 10 instead of the built-in linefeed.)
Bugginess reproducible in Script Editor:
set x to ("blah" as Unicode text) & (return as Unicode text) & (linefeed as Unicode text) & "blah"
set scount to count of characters of x
set chr5 to character 5 of x
set id5 to id of character 5 of x
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {linefeed}
set ccount to count of text items of x
set AppleScript's text item delimiters to oldDelims
{scount, chr5, id5, ccount}
--> {9, "
", {13, 10}, 1}
I don't see any bug there. This is exactly the same as Shane's. As you'd expect since 'as Unicode text' does nothing in Leopard - all those strings and characters are Unicode text already. (return as Unicode text) & (linefeed as Unicode text) combine to make one CrLf character, as Shane said - only one line break, not two; only one character, not two.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden