[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] wrote:
> 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.
As your error message implies, exec() terminates your perl script. You
probably want system() instead.
Also, I'm not sure that would do what you want. I haven't used newgrp, but I
believe it gives you a new shell, which would terminate when the system()
call terminates, effectively doing nothing. Perhaps you can see if you can
set the $) variable instead.
--
Mark Thomas [EMAIL PROTECTED]
Sr. Internet Architect User Technology Associates, Inc.
$_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;;
> -----Original Message-----
> Sent: Thursday, March 08, 2001 1:17 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: [Perl-unix-users] newgrp
>
>
>
> 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
>
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users