do shell script without waiting

I have an Applescript that uses a "do shell script" to start an application. After the application has started I want the Applescript to quit but instead it stays open until I quit the called application. I know that "do script" could do this but I wanted to bypass the Terminal. Is there anyway to bypass the waiting?

PowerBook G4 1Ghz, Mac OS X (10.2.x)

Posted on Jan 19, 2006 2:07 AM

Reply
2 replies

Jan 19, 2006 2:39 AM in response to Monoman1

This is covered in the do shell script bible.

Specifically, AppleScript waits for the shell command to exit before continuing. You can bypass this by telling the shell command to run in the background, and by suppressing the command's stdout and stderr:

do shell script "/bin/blah > /dev/null 2>&1 &"

The '> /dev/null' suppresses stdout; '2>&1' suppresses stderr (specifically, sends stderr to the same place as stdout), and the trailing '&' puts the command in the background.

Using this suffix will return control to your AppleScript immediately, leaving the shell process running in the background.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

do shell script without waiting

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.