Keeping os context possible? Re: Python a good thing for sysadmins ?

Donn Cave donn at drizzle.com
Wed Sep 26 01:15:40 EDT 2001


Quoth Magnus Lycka <magnus at thinkware.se>:
...
| Sorry, you're right about the spawned process of course.
| In general...although you can source shell files to avoid
| spawning a new shell, right?
|
| Anyway, I didn't really check, but I guess that the db2
| command sets an environment variable in the environment of
| the shell where the command is invoked. (However that is
| done, but I guess there is a C call for that.)
|
| So if you run 
| $ db2 login bla bla bla
|
| there will probably be something like below which wasn't there before
|
| $ echo $DB2_SESSION_ID (just guessing here)
| 123123123121

"db2" could do that only if it were a shell alias or function.
In general, your process environment is safe from the commands
you run, they can't touch it, and that applies to python programs.

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list