On 11/21/05, Shawn Corey <[EMAIL PROTECTED]> wrote: > Suvajit Sengupta wrote: > > Hi, > > I want to login into a new group using 'newgrp' UNIX command.Every > > newgrp command invokes a new shell. > > But when I am trying to execute this system command from a perl script > > the script is terminating and returning the prompt of the new shell . > > Can anyone suggest on what can be done to change into a new group from > > within perl script? > > Short answer: You can't. > > Long answer: > > The newgrp command will always run a new shell regardless if it succeeds > or fails. What you can do instead is set the effective group id for the > script. > > 1. Change the script's group to the group you want it to work under (see > `man chgrp`). > > 2. Change the script's "set group id on execution" flag (see `chmod`). > > The script will now run under the new group. > > See `perldoc perlvar` and search for $) and $(. > > >
See also Posix::setgid(). --j -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!