Embedding UNIX Commands

Cesar Rabak csrabak at uol.com.br
Mon Feb 12 19:56:07 EST 2001


D-Man wrote:
> 
> You can use the system function :
> 
> import os
> os.system( "whoami" )
> 
> I don't think you can use setenv -- that is a csh thing, and system()
> won't even start up a shell (AFAIK).  Even if it did, it wouldn't do
> you any good since that shell would terminate and its environment
> would be meaningless.  (Also, on Linux systems bash is the default
> shell)

setenv is also a non standard (albeit very commonplace) function which
is available in several C libraries.

Perhaps Python can call it if it was compiled with a library that has
it?



More information about the Python-list mailing list