• 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
do shell script, redirected piped and backgrounded
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

do shell script, redirected piped and backgrounded


  • Subject: do shell script, redirected piped and backgrounded
  • From: Harald E Brandt <email@hidden>
  • Date: Sat, 6 Dec 2003 15:59:38 +0100

The Technical Note 2065 excellently describes various aspect of the use of do shell script, such as how to redirect standard error to standard output and get it into a file and lastly putting it into background:

do shell script "command > file_path 2>&1 &"

However, I would like to pass all output through a filter, such as 'tr' or 'perl', before it is written to file, AND that filter MUST filter the output from BOTH standard output AND standard error. This is more of a unix sh question than AppleScript, but nevertheless I hope for an answer here. I have already looked into 'man sh', but it is not clear about this combination. I would have expected the following to work:

do shell script "command 2>&1 | tr '\\n' '\\r' > file_path &"

But no matter where I place the pipe or backgrounding '&' etc, it won't do what I want to?


PS: Example of usage: curl, which outputs a mixture of CR and LF.

--heb
_______________________________________________
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: 
 >Reading resource forks (From: Graff <email@hidden>)
 >Re: Reading resource forks (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: It can not be only me...
  • Next by Date: RE: Simple substring help
  • Previous by thread: Re: Reading resource forks
  • Next by thread: Re: do shell script, redirected piped and backgrounded
  • Index(es):
    • Date
    • Thread