• 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: Creating an environment variable from AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating an environment variable from AppleScript


  • Subject: Re: Creating an environment variable from AppleScript
  • From: Simon Forster <email@hidden>
  • Date: Fri, 6 Oct 2006 13:41:41 +0100


On 6 Oct 2006, at 11:16, Kumar Shailove wrote:
I am trying to create an environment variable with AppleScript. The script is as follows

do shell script “export retval=1”

I am executing this script with the osascript command with script file path from Terminal. But the script is not able to set the environment variable.

Any clues, what the problem can be?

Can't remember the exact terminology for it but do shell script effectively is stateless (IIRC). i.e. Each "do shell script" creates its own shell process, does its thing, terminates (with the appropriate exit code I assume). (Once again) I'm assuming that the environment variable is meant to be set for the current terminal session - but "do shell script" is creating its own process; setting the value; and then killing the process.


At least that's my understanding.

Issuing more than one command at a time may work for you?

do shell script "export retval=1; echo $retval"

There's an Apple technical note "TN2065" that may help you ("do shell script in AppleScript").

HTH


Simon Forster _______________________________________________________ LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK Tel: +44 (0)20 8133 0528 Fax: +44 (0)70 9230 5247 _______________________________________________________


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Creating an environment variable from AppleScript (From: "Kumar Shailove" <email@hidden>)

  • Prev by Date: Re: Can't turn off screen savers in System Preferences
  • Next by Date: Universal Applications
  • Previous by thread: Creating an environment variable from AppleScript
  • Next by thread: Re: Creating an environment variable from AppleScript
  • Index(es):
    • Date
    • Thread