• 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: Different behavior with shell scripts with AppleScript versus terminal
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different behavior with shell scripts with AppleScript versus terminal


  • Subject: Re: Different behavior with shell scripts with AppleScript versus terminal
  • From: Axel Luttgens <email@hidden>
  • Date: Tue, 07 Apr 2015 09:28:25 +0200

Le 7 avr. 2015 à 06:27, David Crowe a écrit :

> I am trying to check the validity of a database full of URLs.
>
> In the terminal the following shell code:
>
> cmdid=$$; (sleep 10;kill $cmdid) & exec /usr/bin/curl -I "http://www.gm.com";
>
> Will attempt to access the URL for 10 seconds, and if there is no response will exit anyway (the terminal window reports [Process Completed]).
>
> However, when I run this from "do shell script" it always waits the 10 seconds.
>
> Why is this?

Hello David,

Very likely because with do shell script, your script is running in a non-interactive shell.


> And is there a way to work around this?

You may try by detaching your sub shell:

	cmdid=$$; (sleep 10;kill $cmdid) &>/dev/null & exec /usr/bin/curl -I "http://www.gm.com";

Anyway, I would try to avoid such constructs, especially when the command itself seems to provide the needed tools:

	/usr/bin/curl --max-time 10 -I "http://www.gm.com";

HTH,
Axel
 _______________________________________________
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


  • Prev by Date: Re: Tell Me to Quit in Unix-ese...
  • Next by Date: Re: Tell Me to Quit in Unix-ese...
  • Previous by thread: Re: Tell Me to Quit in Unix-ese...
  • Next by thread: scripting Xcode to import images
  • Index(es):
    • Date
    • Thread