• 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: Weird reply in Tiger vs. Leopard....is this a bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird reply in Tiger vs. Leopard....is this a bug?


  • Subject: Re: Weird reply in Tiger vs. Leopard....is this a bug?
  • From: Jim Skibbie <email@hidden>
  • Date: Thu, 17 Jan 2008 11:13:33 -0600
  • Thread-topic: Weird reply in Tiger vs. Leopard....is this a bug?

OK- After a couple of days trying to sort this out, I can confirm that the
response in Leopard for the do shell script at least for "echo" is
definitely different than in Tiger. See the script snippet below and the
resulting event logs. You'll see that Leopard, the script returns only 20
characters where in Tiger, the same script returns 24.

The really weird thing is that Script Debugger in both operating systems
returns the same event log, but in the actual Apple runtime (e.g., in
Leopard from Script Editor or running from the Scripts menu, the result
returned is different).

I reported this to Apple (bug# 5688436)

Thanks.
Jim

----
Here's a snippet:

set arg to "  All Natural\\nIce Cream\\n  "

log "Before echo: " & arg

set x to length of arg

set y to get every character of arg

log x & "characters as follows: " & y

set arg to do shell script "echo " & quoted form of arg & " | ruby -p -e
'$_.strip!'"

log "After echo: " & arg

set x to length of arg

set y to get every character of arg

log x & "characters as follows: " & y


set arg to "  All Natural\\nIce Cream\\n  "

set arg to strip(arg)

set x to length of arg

set y to get every character of arg

log x & "characters as follows: " & y

on strip(whitespace)
    return do shell script "echo " & quoted form of whitespace & " | ruby -p
-e '$_.strip!'"
end strip

Here's the results:

Log from Script Editor 2.1.1 in 10.4.11:
    (*Before echo:   All Natural\nIce Cream\n  *)
    (*28, characters as follows: ,  ,  , A, l, l,  , N, a, t, u, r, a, l, \,
n, I, c, e,  , C, r, e, a, m, \, n,  ,  *)
tell current application
    do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
        "All Natural\\nIce Cream\\n"
    (*After echo: All Natural\nIce Cream\n*)
    (*24, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, \, n, I,
c, e,  , C, r, e, a, m, \, n*)
    do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
        "All Natural\\nIce Cream\\n"
    (*24, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, \, n, I,
c, e,  , C, r, e, a, m, \, n*)
end tell

Log from Script Editor 2.2 in LEOPARD 10.5.1:
    (*Before echo:   All Natural\nIce Cream\n  *)
    (*28, characters as follows: ,  ,  , A, l, l,  , N, a, t, u, r, a, l, \,
n, I, c, e,  , C, r, e, a, m, \, n,  ,  *)
tell current application
    do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
        "All NaturalIce Cream"
    (*After echo: All NaturalIce Cream*)
    (*20, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, I, c, e,
, C, r, e, a, m*)
    do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
        "All NaturalIce Cream"
    (*20, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, I, c, e,
, C, r, e, a, m*)
end tell

Log from Script Debugger 4.0.8 in 10.4.11:
-- started
(*Before echo:   All Natural\nIce Cream\n  *)
(*28, characters as follows: ,  ,  , A, l, l,  , N, a, t, u, r, a, l, \, n,
I, c, e,  , C, r, e, a, m, \, n,  ,  *)
do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
-->    "All Natural\\nIce Cream\\n"
(*After echo: All Natural\nIce Cream\n*)
(*24, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, \, n, I, c,
e,  , C, r, e, a, m, \, n*)
do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
-->    "All Natural\\nIce Cream\\n"
(*24, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, \, n, I, c,
e,  , C, r, e, a, m, \, n*)
-- stopped

Log from Script Debugger 4.0.8 in LEOPARD 10.5.1:

-- started
(*Before echo:   All Natural\nIce Cream\n  *)
(*28, characters as follows: ,  ,  , A, l, l,  , N, a, t, u, r, a, l, \, n,
I, c, e,  , C, r, e, a, m, \, n,  ,  *)
do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
-->    "All Natural\\nIce Cream\\n"
(*After echo: All Natural\nIce Cream\n*)
(*24, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, \, n, I, c,
e,  , C, r, e, a, m, \, n*)
do shell script "echo '  All Natural\\nIce Cream\\n  ' | ruby -p -e
'$_.strip!'"
-->    "All Natural\\nIce Cream\\n"
(*24, characters as follows: , A, l, l,  , N, a, t, u, r, a, l, \, n, I, c,
e,  , C, r, e, a, m, \, n*)
-- stopped

 _______________________________________________
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

  • Follow-Ups:
    • Re: Weird reply in Tiger vs. Leopard....is this a bug?
      • From: Axel Luttgens <email@hidden>
References: 
 >Re: Weird reply in Tiger vs. Leopard....is this a bug? (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Change Computer name via Applescript
  • Next by Date: Re: Obfuscations and little white lies
  • Previous by thread: Re: Weird reply in Tiger vs. Leopard....is this a bug?
  • Next by thread: Re: Weird reply in Tiger vs. Leopard....is this a bug?
  • Index(es):
    • Date
    • Thread