Setting environment variables for tcsh session

Dan Sommers me at privacy.net
Fri Jul 22 15:01:18 EDT 2005


On Fri, 22 Jul 2005 10:56:22 -0500,
David Durkee <ddurkee at gmail.com> wrote:

> I didn't get much from the discussion of Command Substitution. Any  tips
> on how to do that?

I don't use tcsh, so there may be some subtleties I don't get, but it's
going to look something like this:

----------------changefoo.py
print 'setenv foo bar'
----------------end of changefoo.py

Then the shell session would look like this:

    % `python changefoo.py`
    % echo $foo
    bar

or you may need to "eval" the output:

    % eval `python changefoo.py`
    $ echo $foo
    bar

or you could it like this:

----------------changefoo.py:
print 'foo bar'
----------------end of changefoo.py

Then the shell session would look like this:

    % setenv `python changefoo.py`
    % echo $foo
    bar

But we're veering dangerously off topic for c.l.python.

HTH,
Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>



More information about the Python-list mailing list