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

Re: shell script


  • Subject: Re: shell script
  • From: "Mark J. Reed" <email@hidden>
  • Date: Sat, 17 Jul 2010 21:48:59 -0400

Note that 'do shell script "foo &"' doesn't actually cause the do
shell script to return right away; it still waits for the command to
exit. You have to detach the shell script from the pseudo-terminal
that "do shell script" creates by redirecting its input and output.
But then any output printed by the script disappears (you can replace
/dev/null below with the path to a log file if you want to capture the
latter).

I think a separate script file is cleaner, but it works without one:

do shell script "(
counter=0
while [ $counter -lt 180 ]
do
    if [ -f ~/Desktop/testfile.txt ]
    then
        rm ~/Desktop/testfile.txt
        exit
    fi
    echo \"working\"
    say \"working\"
    sleep 5
    counter=`expr $counter + 1`
done) </dev/null >/dev/null 2>&1 &"



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

References: 
 >shell script (From: louie <email@hidden>)

  • Prev by Date: shell script
  • Next by Date: Re: Search and Replace in String
  • Previous by thread: shell script
  • Next by thread: Mask to input many data
  • Index(es):
    • Date
    • Thread