• 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: Copy folder shell scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy folder shell scripting


  • Subject: Re: Copy folder shell scripting
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 22 May 2008 09:44:36 -0400

CN = Chris Nebel

CN> It's an artifact of how "do shell script" returns its output -- it
CN> uses \r for line breaks, which means that in Terminal, all the lines
CN> print on top of each other, and you see a mish-mash of all of them.
CN> In the particular case of "do shell script", you can add "without
CN> altering line endings", or pipe everything through "tr \r \n".

BR = Bruce Robertson
BR> Well, when you try, the \r and \n get converted into returns in script
BR> editor and escaping them doesn't seem to work.

What exactly did you try?  If you're using tr instead of just "without
altering line endings", you have to be sure to get all the quoting
right.  There are multiple ways to do that which all work, but there
are even more ways to get it wrong.  :)  These should work, for
instance:

do shell script " ... | tr '\r' '\n'"

In this case, Applescript turns the \r and \n into literal carriage
return and newline, which, since they're inside single-quoted strings
at the shell level, make it through to tr just fine.

do shell script "... | tr '\\r' '\\n'"

In this case, Applescript sends the literal strings backslash-r and
backslash-n to tr, which then translates them itself.

But I'd be much more inclined to just let Applescript do the work via
"without altering line endings".

--
Mark J. Reed <email@hidden>
 _______________________________________________
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

References: 
 >Re: Copy folder shell scripting (From: Bruce Robertson <email@hidden>)

  • Prev by Date: Re: Rename nested folders
  • Next by Date: Re: Rename nested folders
  • Previous by thread: Re: Copy folder shell scripting
  • Next by thread: Difficulties with choose file of type - PowerPoint
  • Index(es):
    • Date
    • Thread