Re: Creating an environment variable from AppleScript
Re: Creating an environment variable from AppleScript
- Subject: Re: Creating an environment variable from AppleScript
- From: Doug McNutt <email@hidden>
- Date: Fri, 6 Oct 2006 14:37:02 -0600
At 15:46 +0530 10/6/06, Kumar Shailove wrote:
>I am trying to create an environment variable with AppleScript. The script is as follows
>do shell script "export retval=1"
Remember that logging in to Aqua in Mac OS neXt does not log you in with a UNIX shell. DFUs are not supposed to have to worry about things like that.
>Any clues, what the problem can be?
So there is no problem unless you are one of those UNIX nerds who learned about logging in a few decades ago.
1) You can set up a sort of login script by creating an XML file that the Aqua login will execute. It can set environment variables but not aliases and other things you might want. The file and directory are: $HOME/.MacOSX/environment.plist. The format is available on apple.com. Ask if you'd like a copy of mine. That file is read as you login and you can't muck with it to change things without a logout-login to Aqua sequence. It is possible, but painful, to access it with the defaults tool.
2) You can open Terminal.app and create a named window. That will execute your "rc" scripts and the results will apply to that window only. A new window will start another login which will not honor what you have done in the first. You can execute commands in an open Terminal.app window using an AppleScript tell block addressing Terminal.app Terminal with a do script in a named window.
3) You can control things in a BBEdit worksheet much like Terminal but with a memory of what you did long ago. But each BBEdit worksheet will have its own environment just like Terminal.app. Applescripting with the osascript tool will allow you the advantages of AppleScript while accessing it from an environment that you can set up the way you once did with real UNIX.
4) You can set up a $HOME/.tcshrc or the equivalent in bash and set environment variables there. If you create a file with a #! line and put your commands there a "do shell script" pointing to the file will execute your rc script on entry. Using $SHLVL you can get some control over what happens at what time. It helps to do a few echos to a log file in the rc script so you can see what's happening.
5) You can consider Linux but its graphical user interfaces have many of the same "problems".
Watch out for rc-like scripts in /etc/ - er /private/etc/ - that can arbitrarily rewrite your $PATH variable even though you set it up in environment.plist.
--
--> From the U S of A, the only socialist country that refuses to admit it. <--
_______________________________________________
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