• 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: do shell script hanging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do shell script hanging


  • Subject: Re: do shell script hanging
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 10 Apr 2008 07:19:06 -0400

On Thu, Apr 10, 2008 at 4:49 AM, Bastiaan Boertien
<email@hidden> wrote:
> Put this in a shell script file:
>
>
> exec $* &> /dev/null &
> echo $!

> do shell script "path/to/thread.sh " & quoted form of
> "/Applications/Firefox2.app/Contents/MacOS/firefox -P toto"

The disconnection is incomplete, but more importantly, that approach
will fail for any pathnames which contain spaces, which tend to crop
up a lot on OS X.

Try this instead:

#!/bin/sh
prog="$1"
shift
exec "$prog" "$@" </dev/null >/dev/null  2>&1 &
echo $!

And then you can invoke it without any more quoting than what you need
any time you're doing do shell script.  For instance, this will work:

do shell script "/path/to/thread.sh
/Applications/Firefox2.app/Contents/MacOS/firefox -P toto"


--
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

  • Follow-Ups:
    • Re: do shell script hanging
      • From: "Mark J. Reed" <email@hidden>
References: 
 >do shell script hanging (From: "Yvon Thoraval" <email@hidden>)
 >Re: do shell script hanging (From: Skeeve <email@hidden>)
 >Re: do shell script hanging (From: "Mark J. Reed" <email@hidden>)
 >Re: do shell script hanging (From: Bastiaan Boertien <email@hidden>)

  • Prev by Date: Re: What is the limit on osascript command ?
  • Next by Date: Re: do shell script hanging
  • Previous by thread: Re: do shell script hanging
  • Next by thread: Re: do shell script hanging
  • Index(es):
    • Date
    • Thread