Re: Do Shell script with unix sub command and CocoaDialog
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