Re: $HOME/.login
Re: $HOME/.login
- Subject: Re: $HOME/.login
- From: Doug McNutt <email@hidden>
- Date: Tue, 5 Aug 2003 09:40:06 -0600
At 02:08 -0400 8/5/03, Jonathan Levi MD wrote:
>
On Mon, 4 Aug 2003 15:53:31 -0600, Doug McNutt <email@hidden> wrote:
>
>
>I really would like my $HOME/.login to be executed when I log in to Aqua instead of only when executing Terminal or logging in remotely. Environment settings made that way can apply to applications. That is apparently not going to happen in Panther or anything else shy of Linux.
>
>
Perhaps I'm not understanding you -- but couldn't you create a one-line AppleScript
>
>
do shell script "source /Users/<yourname>/.login"
>
>
save it as an application, and put an alias of it into the Login Items?
Yes. But it won't work in Jaguar and probably not in Panther. The problem is that UNIX itself has very strong rules about a daughter process never being able to modify the environment of its parent. Good or bad, that's the way it was built and there are some pretty good arguments for having it the way it is.
In a .login file executed as the main shell for an entire UNIX login session it is possible to set up environment variables that stick for everything you do. One can even "source" scripts so that they are executed at the login level and do modify a user's environment for the entire logged in period.
AppleScript is an Aqua application. It is not executed as a daughter process of your login shell. In fact many users don't even have a login shell. They never executed Terminal or logged in with SSH. The closest they can get to a login-wide environment is to define a few things in $HOME/.MacOSX/environment.plist and one cannot execute shell scripts there to, for instance, add a directory to the system defined $PATH variable.
Your proposed AppleScript will instantiate an instance of (bs)sh which will duly source the file but whatever is done will not penetrate the UNIX provision that the daughter - AppleScript's shell - cannot affect the environment of its parent - AppleScript. All changes will be discarded when AppleScript terminates the temporary shell.
What's needed, and it has to be done by Apple, is for all logged-in users to have a real UNIX shell running in the background. Non-geeks need not even know about it. Aqua applications executed by that user need to be given the user's UNIX environment as though it had come from the existing environment.plist XML file. But it should be OK for a PRO-geek to go back to his chosen login shell and change his environment which would then apply to newly started applications..
And by the way, environment.plist is read at Agua login time and not each time an Application is started up. An on-the-fly edit of environment.plist will not change anything until you log out and log in again. The items in environment.plist are either ignored by Terminal or overlaid by other items like the default /etc/cshell_login.
Note that, once an environment variable is defined and exported it is possible for its value to be reset by a daughter process. I need to study more to see how and if such changes might be passed up to the parent.
--
--> If you are presented a number as a percentage, and you do not clearly understand the numerator and the denominator involved, you are surely being lied to. <--
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.