• 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: Do Shell script with unix sub command and CocoaDialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do Shell script with unix sub command and CocoaDialog


  • Subject: Re: Do Shell script with unix sub command and CocoaDialog
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 6 Mar 2008 17:01:32 -0500

On Thu, Mar 6, 2008 at 4:17 PM, Skeeve <email@hidden> wrote:
>  > redirects to a file
>  | redirects to a process

Nope. Process substitution.  POSIX feature found in bash and newer
kshes.  Somewhat broken on Tiger, IIRC, but works fine on Leopard.

Basically, >(some command) causes "some command" to get run with its
input connected to a pipe; the >(...) gets replaced by the /dev/fd/
path to the other end of the pipe.  <(some command) works the same way
in reverse.  Mostly useful when you need to pass multiple data streams
from different commands, or when you have a recalcitrant program like
Chris mentions that insists upon a named file.  (Though in such a case
it's likely the command is trying to do random access, which still
won't work with process substitution).

Anyway, "do shell script" uses /bin/sh, not bash, so you don't get
that feature.  But as Chris said, in this particular case there's no
reason not to just use a pipe.

My most frequent use of process substitution is to look at a file and
see how big it is at the same time without bringing it up in an
editor:

cat file | tee >(wc -l)

which is not really all that exciting...

--
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: 
 >Do Shell script with unix sub command and CocoaDialog (From: Tim Piper <email@hidden>)
 >Re: Do Shell script with unix sub command and CocoaDialog (From: Skeeve <email@hidden>)

  • Prev by Date: Re: Do Shell script with unix sub command and CocoaDialog
  • Next by Date: re: Sometime error -10006 copying a folder
  • Previous by thread: Re: Do Shell script with unix sub command and CocoaDialog
  • Next by thread: Re: Do Shell script with unix sub command and CocoaDialog
  • Index(es):
    • Date
    • Thread