• 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: Scripting Additions: Embracing the Horror of Unix ($0=sh)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Scripting Additions: Embracing the Horror of Unix ($0=sh)
      • From: Oliver Sun <email@hidden>
References: 
 >Re: Scripting Additions: Embracing the Horror of Unix ($0=sh) (From: Oliver Sun <email@hidden>)

  • Prev by Date: Re: (no subject)
  • Next by Date: Re: Scripting Additions: Embracing the Horror of Unix ($0=sh)
  • Previous by thread: Re: Scripting Additions: Embracing the Horror of Unix ($0=sh)
  • Next by thread: Re: Scripting Additions: Embracing the Horror of Unix ($0=sh)
  • Index(es):
    • Date
    • Thread