On Jan 9, 9:18 pm, Zentrader <[EMAIL PROTECTED]> wrote: > On Jan 9, 5:56 am, Svenn Are Bjerkem <[EMAIL PROTECTED]> > wrote: > > >I have been looking for a way to execute this command > > as a part of a script, but it seems that the changes are only valid in > > the context of the script and when the script exits, the current shell > > still have the original "users" group setting. > > I don't think you would want it any other way. Would you want a user > to be able to change the group and have it remain permanently? Who's > going to remember whether they were last in "A" or "B", and it opens > up oportunities for the practical joker when you go to the restroom > and leave the terminal on. Put the "change the group" code into a > separate function in a separate file (with only you as the owner) and > call it whenever you want to change groups.
I am trying to create a script that make it easy for users in a design team to create files that belong to the same group, but retain the users uid. In order to make it visible that the user is creating files with a different gid, the script will change the prompt to indicate so. In a tcl solution I have now, the users home is changed to the design area as some tools are reading and writing setup files into $HOME. I have not found a way to change the gid in tcl so I turned to python in hope that this scripting language could do so. The tcl solution spawns a new tcsh after setting several environment variables and works quite well except for not being able to change gid. And it is also a wish from my side to port this script to python. Is your suggestion to put "newgrp design" into a new file and then exec this file in my python script? What happens to the group id of the shell that called the python script in this case? I would try to avoid spawning a new tcsh as this make execution of tools on a remote computer difficult as the handover of command line arguments does not seem to be handed over to the newly spawned shell. I may be understanding something wrongly here. -- Svenn -- http://mail.python.org/mailman/listinfo/python-list