On Sep 8, 2008, at 05:41 , Simon King wrote:
>
> Dear David,
>
> On Sep 8, 2:09 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
>> I haven't tried this but I would imagine you could run a bash script
>> which sets the environment variables like this:
>> ...
>
> It did not work. I wrote a shell script SetMyPath that changes the
> PATH, and i tested that from the shell
> . SetMyPath
> and
> source SetMyPath
> both work (simply doing ./SetMyPath would not change PATH because it
> would live in a different subshell)
>
> But when i am in Sage, neither
> sage: !. SetMyPath
> nor
> sage: !source SetMyPath
> nor
> sage: !./SetMyPath
> work. Still, os.environ['PATH'] has the same content as before.
When you execute a command with "!", that command can't affect the
'sage' process that is already running (for much the same reason you
mention for using "./SetMyPath" from the shell).
You can do something like this
sage: XXX=os.environ['PATH'] ## Save in case you want to restore
later during this run
sage: os.environ['PATH']=XXX + ":/tmp"
Now, when you type "!boink", the shell that gets invoked with get set
up with a PATH that includes "/tmp", so that the command "/tmp/boink"
will be executed (if it exists). The effects of this change will be
seen in any subsequent shell that is invoked from 'sage', until you
change that variable again.
Hope that is clear, and helps L-}
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Absorption of Federal Funds
--------
Men are from Earth.
Women are from Earth.
Deal with it.
--------
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---