title: Redirecting to stdin in order to execute script in vxworks 6.7
body: <p>I need to execute a script in vxWorks 6.7. It can be done with the execute() function in vxworks 5.5. The solution that I am applying is to use stdin redirection as in the following code:</p>
  
  <pre><code>    newStdIn = open("myScript.txt",O_RDONLY,0644);
      oldStdIn=ioGlobalStdGet(STD_IN);
      ioGlobalStdSet(STD_IN, newStdIn);
      /*Read file here and execute*/
      ioGlobalStdSet(STD_IN,oldStdIn); /*Restore old stdIn*/
      close(newStdIn);
  </code></pre>
  
  <p>I am missing the read and execute part (where the comment is).</p>
  
  <p><strong>EDIT:</strong>
  According to the vxworks kernel programmers guide, the way to execute a script is as follows:</p>
  
  <pre><code>    fdScript = open ("myScript", O_RDONLY);
      shellGenericInit ("INTERPRETER=Cmd", 0, NULL, &amp;shellTaskName, FALSE, FALSE, fdScript, STD_OUT, STD_ERR);
      do
         taskDelay (sysClkRateGet ());
      while (taskNameToId (shellTaskName) != ERROR);
      close (fdScript);
  </code></pre>
  
  <p>But it will open a new shell without processing the script.
  The problem with this is that my application won't do anything after calling shellGenericInit.</p>