os.putenv ?

Jacek Generowicz Jacek.Generowicz at cern.ch
Fri Mar 28 02:54:50 EST 2003


sik0fewl <xxdigitalhellxx at hotmail.com> writes:

> > Set up the environment for a user who is about to be running lots
> > of Python scripts ... without having to write a shell script for
> > each flavour of UNIX shell under the sun ... so trying it in
> > Python seemed the natural way.
> 
> I don't think that's necessary. Write a bourne shell script, I'm
> pretty sure every* system comes with it.
> 
> 
> #!/bin/sh
> ...

   [jacek] echo $0
   bash
   [jacek] cat hmm.sh 
   #!/bin/sh
   export GRR="This is a late parrot."
   [jacek] source hmm.sh 
   [jacek] echo $GRR
   This is a late parrot.

Great. Now ... what if the user uses tcsh ...

   ~ > echo $0
   tcsh
   ~ > cat hmm.sh 
   #!/bin/sh
   export GRR="This is a late parrot."
   ~ > source hmm.sh 
   export: Command not found.
   ~ > echo $GRR
   GRR: Undefined variable.

I can't really expect users to change their shells, just because I'm
too lazy to write a script for their shell.




More information about the Python-list mailing list