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 $(.



--

Just my 0.00000002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to