title: Executing Command on child shell
body: <p>Here is the updated question</p>
  
  <p><strong>Script:</strong></p>
  
  <pre><code>open (my $pipe, "| ptsetenv.sh $ProductType $Release");
  
  print $pipe "genidasack.py -v --alignment=mips64 -a -s $WORKSPACE/dbgen/ose_signals_ADA.sdt -o $WORKSPACE/$Product/\n";
  
  close ($pipe);  
  </code></pre>
  
  <p><strong>Command 2:</strong> </p>
  
  <pre><code>ptsetenv.sh $ProductType $Release  # Sets Environment Variables and creates a Child Shell
  </code></pre>
  
  <p><strong>Command 3:</strong> </p>
  
  <pre><code>genidasack.py -v --alignment=mips64 -a -s $WORKSPACE/dbgen/ose_signals_ADA.sdt -o $WORKSPACE/$Product/\n #this has to be executed on child Shell created by Command 2  
  </code></pre>
  
  <p>Currently when i run the script within a perl script after first line child shell is invoked and script remains at child shell when type exit from child shell subsequent script lines are executed which is not what is needed!</p>
  
  <p><strong>HERE ARE CONTENTS OF ptsetenv.sh</strong></p>
  
  <pre><code> envsetup.py $*
  
   ./export_env.sh
  </code></pre>
  
  <p>export_env.sh is the script which basically creates the child shell</p>
  
  <p>Let me know if you need contects of export_env.sh</p>
  
  <p><strong>HERE ARE CONTENTS OF export_env.sh</strong></p>
  
  <pre><code>has_dir()
  
      {
                   if [ -d $1 ]; then
                       return 0
                  else
                   return 1
                  fi
             }
              has_dir $DXENVROOT
               if [ "$?" != "0" ]; then
                  echo "Directory $DXENVROOT does not exist. Exiting the script."
                  exit -1
              fi
   echo "Environment set to ${DXENVNAME} ${DXENVVERSTR}"
  
   echo $SHELL
  
   $SHELL
  
  echo "Exiting ${DXENVNAME} ${DXENVVERSTR} shell"
  </code></pre>