Re: Scripting Additions: Embracing the Horror of Unix ($0=sh)
Re: Scripting Additions: Embracing the Horror of Unix ($0=sh)
- Subject: Re: Scripting Additions: Embracing the Horror of Unix ($0=sh)
- From: garbanzito <email@hidden>
- Date: Mon, 4 Feb 2002 15:18:13 -0700
at 2002 02 04, 11:39 -0500, they whom i call Oliver Sun wrote:
Without passing the quoted script to bin/sh or some other command
interpreter, how does the AppleScript manage to call commands such
as "pwd" or "echo", or perform wildcard expansions, all of which are
built-in shell features and _not_ separate programs (unlike
"/bin/ps")?
there is /bin/pwd and /bin/echo ...
but it turns out you are right that the script spawns a
shell process. i had missed it because with my simpler ps
example, the shell had already exited before the ps command
did its work (and so Script Editor took over as parent of
ps).
suspecting that, i tried this script:
do shell script "ps axwwopid,ppid,command >foo.text; echo foo"
which, because of the semicolon, runs echo only after ps
completes, so the shell process can't exit before ps runs.
the result:
PID PPID COMMAND
1101 72 /Applications/AppleScript/Script
Editor.app/Contents/MacOS/Script Editor -psn_0_2621441
10765 1101 sh -c ps axwwopid,ppid,command >foo.text; echo foo
10766 10765 ps axwwopid,ppid,command
there it is, the script editor spawns a shell process which
spawns the ps process.
--
steve harley email@hidden