title: How do you use newgrp in a script then stay in that group when the script exits
body: <p>I am running a script on a solaris Box. specifically SunOS 5.7. I am not root. I am trying to execute a script similar to the following:</p>
  
  <blockquote>
    <blockquote>
      <p>newgrp thegroup &lt;&lt;
      FOO<br>
      source .login_stuff<br>
      echo "hello world"<br>
      FOO</p>
    </blockquote>
  </blockquote>
  
  <p>The Script runs. The problem is it returns back to the calling process which puts me in the  old group with the source .login_stuff not being sourced. I understand this behavior. What I am looking for is a way to stay in the sub shell. Now I know I could put an xterm&amp;  (see below) in the script and that would do it, but having a new xterm is undesirable.  </p>
  
  <blockquote>
    <p>Passing your current pid as a parameter.</p>
    
    <blockquote>
      <p>newgrp thegroup &lt;&lt;
      FOO<br>
      source .login_stuff<br>
      xterm&amp;<br>
      echo $1<br>
      kill -9 $1<br>
      FOO</p>
    </blockquote>
  </blockquote>
  
  <p>I do not have sg available.
  Also, newgrp is necessary.</p>