Excuting a script from a powerhouse program by sourcing it (w as: Run command temp.sh)

Edis, Robert Robert.Edis@blistex.com
Thu, 15 May 2003 09:46:31 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C31AF0.C61AE370
Content-Type: text/plain;
	charset="iso-8859-1"

Now THIS is why I LOVE OpenVMS!  I had these problems whenever I've used a
flavour of UNIX.  It's so simple in VMS using symbols and logicals in the
various contexts.  UNIX doesn't seem to understand to idea of context.
 
Blue

-----Original Message-----
From: Fry, Mark [mailto:Mark.Fry@cognos.com]
Sent: Thursday, May 15, 2003 3:17 AM
To: 'karen d'souza'; Darren Reely
Cc: 'powerh-l@lists.swau.edu'
Subject: RE: Excuting a script from a powerhouse program by sourcing it (w
as: Run command temp.sh)


Hi Karen,
 
You want to execute temp.sh in the same shell?  Hmmm...  The problem is that
when you issue a RUN COMMAND, your current process is not in the original
shell, but rather a child of the quick process used to fire up the screen in
the first place.  If you want your command to run in a shell, you have to
ask for it (ie fork a new shell below your quick process by doing RUN
COMMAND "sh -c '. temp.sh'").  Of course, as soon as the RUN COMMAND has
finished, you drop back to the quick process (ie your screen) and lose
whatever variables were set in your forked shell.
 
>From within your screen, you cannot make changes to the original shell you
were in before you started the screen, as it is the parent process of your
screen, which in turn is the parent process of whatever you ask for in your
RUN COMMAND.  You can see this effectively if you issue a RUN COMMAND "ksh"
from quick.  When you run the command, you fork a new shell.  It's parent is
not your original shell, but rather the quick process for your screen (do a
ps -f to see this).
 
Looks like you will need to source temp.sh before you launch quick.
 
Hope this clarifies things a bit.
 
Cheers!
 
Mark Fry
Mark.Fry@Cognos.com

-----Original Message-----
From: karen d'souza [mailto:kaz_dsouza@yahoo.com]
Sent: 15 May 2003 05:45
To: Darren Reely
Cc: 'powerh-l@lists.swau.edu'
Subject: Excuting a script from a powerhouse program by sourcing it (was:
Run command temp.sh)


Apologies for the messedup subject, will take care next time onwards.
 
> run command "temp.sh" &

Yes, this will run tem.sh, but the shell does so by forking a new process,
due to which my exported variables from temp.sh are lost. I am trying to do
`. temp.sh', as I want to execute temp.sh in the _same_ shell. Is there a
way I can run temp.sh in the same shell ?
 
Thanks in advance.
 
Karen.


Darren Reely <darren.reely@latticesemi.com> wrote: 

First, will you _PLEASE_ put proper subject descriptions in you e-mails. 
It is impossible to keep track of your requests.

Here is a sample from my code.

run command "chmod +x temp.sh" on error continue
run command "temp.sh" &
clear lines 20 to 23 &
on error continue response

Notice I have no period & space as your sample does. Perhaps you 
intended your space to be a forward slash?

Darren.
P.S. I'm running Solaris Unix.

karen d'souza wrote:

> 
> I am using
> RUN COMMAND ". temp.sh"
> 
> At run time it throws an error message execution permission denied 
> even after giving all permissions to the file temp.sh.
> 
> I am working on HP-UX.
> 
> Any suggestions
> ------------------------------------------------------------------------
> Do you Yahoo!?> The New Yahoo! Search 
> - 
> Faster. Easier. Bingo. 






  _____  

Do you Yahoo!?
The  <http://us.rd.yahoo.com/search/mailsig/*http://search.yahoo.com> New
Yahoo! Search - Faster. Easier. Bingo.


This message may contain privileged and/or confidential information. If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so. Thank you.


------_=_NextPart_001_01C31AF0.C61AE370
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2722.900" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=359524514-15052003>Now 
THIS is why I LOVE OpenVMS!&nbsp; I had these problems whenever I've used a 
flavour of UNIX.&nbsp; It's so simple in VMS using symbols and logicals in the 
various contexts.&nbsp; UNIX doesn't seem to understand to idea of 
context.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=359524514-15052003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=359524514-15052003>Blue</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Fry, Mark 
  [mailto:Mark.Fry@cognos.com]<BR><B>Sent:</B> Thursday, May 15, 2003 3:17 
  AM<BR><B>To:</B> 'karen d'souza'; Darren Reely<BR><B>Cc:</B> 
  'powerh-l@lists.swau.edu'<BR><B>Subject:</B> RE: Excuting a script from a 
  powerhouse program by sourcing it (w as: Run command 
  temp.sh)<BR><BR></FONT></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff size=2>Hi 
  Karen,</FONT></SPAN></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff size=2>You 
  want to execute temp.sh in the same shell?&nbsp; Hmmm...&nbsp; The problem is 
  that when you issue a RUN COMMAND, your current process is not&nbsp;in the 
  original&nbsp;shell, but rather a child of the quick process used&nbsp;to fire 
  up&nbsp;the screen in the first place.&nbsp; If you want your command to run 
  in a shell, you have to ask for it (ie fork a new shell below your quick 
  process by doing </FONT></SPAN><SPAN class=696594707-15052003><FONT face=Arial 
  color=#0000ff size=2>RUN COMMAND "sh -c '. temp.sh'").&nbsp; Of course, as 
  soon as the RUN COMMAND has finished, you drop back to the quick process (ie 
  your screen) and lose whatever variables were set in your forked 
  shell.</FONT></SPAN></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff size=2>From 
  within your screen, you cannot make changes to&nbsp;the original shell you 
  were in before you started the screen, as it is the parent process of your 
  screen, which in turn is the parent process of whatever you ask for in your 
  RUN COMMAND.&nbsp; You can see this effectively if you issue a RUN COMMAND 
  "ksh" from quick.&nbsp; When you run the command, you fork a new shell.&nbsp; 
  It's parent is not your original shell, but rather the quick process for your 
  screen (do a ps -f to see this).</FONT></SPAN></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2>Looks like you will need to source temp.sh before you launch 
  quick.</FONT></SPAN></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff size=2>Hope 
  this clarifies things a bit.</FONT></SPAN></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2>Cheers!</FONT></SPAN></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff size=2>Mark 
  Fry</FONT></SPAN></DIV>
  <DIV><SPAN class=696594707-15052003><FONT face=Arial color=#0000ff 
  size=2>Mark.Fry@Cognos.com</FONT></SPAN></DIV>
  <BLOCKQUOTE>
    <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
    size=2>-----Original Message-----<BR><B>From:</B> karen d'souza 
    [mailto:kaz_dsouza@yahoo.com]<BR><B>Sent:</B> 15 May 2003 
    05:45<BR><B>To:</B> Darren Reely<BR><B>Cc:</B> 
    'powerh-l@lists.swau.edu'<BR><B>Subject:</B> Excuting a script from a 
    powerhouse program by sourcing it (was: Run command 
    temp.sh)<BR><BR></FONT></DIV>
    <DIV>
    <DIV>Apologies for the messedup subject, will take care next time 
    onwards.</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&gt; run command "temp.sh" &amp;<BR></DIV>
    <DIV>Yes, this will run tem.sh, but the shell does so by forking a new 
    process, due to which my exported variables from temp.sh are lost. I am 
    trying to do `. temp.sh', as I want to execute temp.sh in the _same_ shell. 
    Is there a way I can run temp.sh in the same shell ?</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>Thanks in advance.</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>Karen.</DIV><BR><BR><B><I>Darren Reely 
    &lt;darren.reely@latticesemi.com&gt;</I></B> wrote: 
    <BLOCKQUOTE 
    style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">First, 
      will you _PLEASE_ put proper subject descriptions in you e-mails. <BR>It 
      is impossible to keep track of your requests.<BR><BR>Here is a sample from 
      my code.<BR><BR>run command "chmod +x temp.sh" on error continue<BR>run 
      command "temp.sh" &amp;<BR>clear lines 20 to 23 &amp;<BR>on error continue 
      response<BR><BR>Notice I have no period &amp; space as your sample does. 
      Perhaps you <BR>intended your space to be a forward 
      slash?<BR><BR>Darren.<BR>P.S. I'm running Solaris Unix.<BR><BR>karen 
      d'souza wrote:<BR><BR>&gt; <BR>&gt; I am using<BR>&gt; RUN COMMAND ". 
      temp.sh"<BR>&gt; <BR>&gt; At run time it throws an error message execution 
      permission denied <BR>&gt; even after giving all permissions to the file 
      temp.sh.<BR>&gt; <BR>&gt; I am working on HP-UX.<BR>&gt; <BR>&gt; Any 
      suggestions<BR>&gt; 
      ------------------------------------------------------------------------<BR>&gt; 
      Do you Yahoo!?<B! R>&gt; The New Yahoo! Search <BR>&gt; <HTTP: 
      search.yahoo.com *http: mailsig search us.rd.yahoo.com>- <BR>&gt; Faster. 
      Easier. Bingo. <BR><BR><BR></BLOCKQUOTE></DIV>
    <P>
    <HR SIZE=1>
    Do you Yahoo!?<BR><A 
    href="http://us.rd.yahoo.com/search/mailsig/*http://search.yahoo.com">The 
    New Yahoo! Search</A> - Faster. Easier. Bingo.</BLOCKQUOTE><BR>
  <P><FONT face=Arial size=2>This message may contain privileged and/or 
  confidential information. If you have received this e-mail in error or are not 
  the intended recipient, you may not use, copy, disseminate or distribute it; 
  do not open any attachments, delete it immediately from your system and notify 
  the sender promptly by e-mail that you have done so. Thank 
you.</FONT></P></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C31AF0.C61AE370--