Here are some examples of a shortened script, the commands I used and the
results I got. The "%" separate the samples. None of the samples when run,
printed anything.
OS = Solaris
Perl = version 5.005_02
********************************************************
#!/usr/local/bin/perl -w
while () {
exec ("newgrp dev");
print 'Enter a 6-8 digit Project Name: ';
}
********************************************************
> perl c.pl
> Statement unlikely to be reached at c.pl line 5.
>(Maybe you meant system() when you said exec()?)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***********************************************************
#!/usr/local/bin/perl -w
while () {
system ('newgrp dev');
print 'Enter a 6-8 digit Project Name: ';
}
**************************************************************
> perl c.pl
Doing it this way changes the group to dev, but it won't continue the
script. It brings you back to a prompt where you can run commands, but you
know you are in another process or something b/c you type "exit" and it says
"logout" and returns you to your original state.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***********************************************************
#!/usr/local/bin/perl -w
while () {
`newgrp dev`;
print 'Enter a 6-8 digit Project Name: ';
}
**************************************************************
> perl c.pl
Doing it this way does nothing so far as I can tell. It returns you to the
prompt and you can't run commands or do anything. I had to close my session
and restart. Note - All my other system commands are run this way.
> -----Original Message-----
> From: Wes Wannemacher [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, March 08, 2001 10:32 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [Perl-unix-users] newgrp
>
> On Thu, Mar 08, 2001 at 10:11:13AM -0700, [EMAIL PROTECTED] wrote:
> > I change between 2 primary groups in unix and I must be in the correct
> group
> > when I run certain scripts.
> >
> > Therefore, I wanted to add a line like `newgrp dev`;
> >
> > When I add this and run it, it doesn't work for one and second it goes
> back
> > to the prompt and you have to exit before you can do anything else.
> Like it
> > opens a new process and can't continue with the script.
> >
> > Any help to add this functionality to my scripts would be appreciated.
> >
> >
>
> First off you didn't post a sufficient amount of information to get any
> real good help. What is your OS Linux, BSD, Solaris, etc. What version
> of perl are you running 5, 5.6? I would also need to see more of the
> code to get a better idea of your problem.
>
> Did you try system() and exec() functions?
>
> ->W
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Wesley Wannemacher
> Instructor / Network Administrator
> University of Northwestern Ohio
> http://www.unoh.edu/
> [EMAIL PROTECTED]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> --
> Chip Salzenberg sent me a complete patch to add System V IPC (msg, sem and
> shm calls), so I added them. If that bothers you, you can always undefine
> them in config.sh. :-) -- Larry Wall in <[EMAIL PROTECTED]>
> --
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users