Re: Multiline commands in do shell script
Re: Multiline commands in do shell script
- Subject: Re: Multiline commands in do shell script
- From: Walter Ian Kaye <email@hidden>
- Date: Tue, 3 Feb 2004 10:15:16 -0800
At 10:09a -0600 02/03/2004, John C. Welch didst inscribe upon an
electronic papyrus:
So I need to deal with a command that never exits, (mDNS to be precise) and
do shell script.
Because of the way mDNS works, even if I run it as this:
mDNS -B _ssh._tcp local. > ~/Desktop/mDNSService.txt &
I never return from the do shell script step.
Here, this may help:
From: Christopher Nebel <email@hidden>
Subject: Re: mutli instances test (was Re: Multi-threaded)
Date: Mon, 10 Nov 2003 11:22:16 -0800
To: Applescript Users <email@hidden>
On Nov 9, 2003, at 9:30 PM, Graff wrote:
Here's Apple's details on the "do shell script command". Tons of
good stuff in there but nothing that helps me to solve this
particular problem.
<http://developer.apple.com/technotes/tn2002/tn2065.html>
You didn't read carefully enough. (Admittedly, the question is a
bit misleadingly labeled for this problem.) See "I want to start a
background server process; how do I make do shell script not wait
until the command completes?" under "Other Concerns".
The problem is that just "&" isn't good enough to disconnect the
process under "do shell script" -- it's still waiting for stdout and
stderr to return end-of-file. Use the following incantation instead:
do shell script "command > file_path 2>&1 &
If you don't care about the output (which you don't in this case),
use "/dev/null" for file_path. Incidentally, you'd have much the
same problem using backquotes in Perl, though Perl only watches
stdout, so you wouldn't need the "2>&1" part.
--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.