Think I found a big bug in sed or shell scripting in AppleScript.
Copy the code below, run and look at the output.
\n gets appended to the last line of the return string every time this is run.
on run Main() end run
on Main() set myString to "abcdefg" repeat with myIndex from 1 to 100 log the length of myString set myString to SedNuketheFirstCharIfItIsAPeriod(myString) end repeat log the length of myString end Main
on SedNuketheFirstCharIfItIsAPeriod(myText) set mySuffix to "<<<" & quoted form of myText set cmd to "sed 's:^a::'" & mySuffix do shell script cmd without altering line endings return result end SedNuketheFirstCharIfItIsAPeriod
This email message and any attachments are for the sole use of the intended recipient(s) and may contain information that is proprietary to U.S. Foodservice, Inc and/or its subsidiaries or otherwise confidential or legally privileged. If you have received this message in error, please notify the sender by reply, and delete all copies of this message and any attachments. If you are the intended recipient you may use the information contained in this message and any files attached to this message only as authorized by U.S. Foodservice. Files attached to this message may only be transmitted using secure systems and appropriate means of encryption, and must be secured using the same level password and security protection with which the file was provided to you. Any unauthorized use, dissemination or disclosure of this message or it's attachments is strictly prohibited.
|