<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: export Variable problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752288#M834835</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;simple answer: you cannot.  The environment of a child process is lost when it exits.&lt;BR /&gt;&lt;BR /&gt;You will need to "source" the script if you want to keep the environment.  Why would you not use this option? :&lt;BR /&gt;. /dir/B.sh&lt;BR /&gt;&lt;BR /&gt;Other tricks are to put the value in a temp file and read it, put the export command in a temp file and source it, ....&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Thierry.</description>
    <pubDate>Wed, 26 Jun 2002 08:17:46 GMT</pubDate>
    <dc:creator>Thierry Poels_1</dc:creator>
    <dc:date>2002-06-26T08:17:46Z</dc:date>
    <item>
      <title>export Variable problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752286#M834833</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;How do I export a variable from child to parent shell?.  &lt;BR /&gt;Example:&lt;BR /&gt;A.sh&lt;BR /&gt;-----&lt;BR /&gt;export XYZ=10&lt;BR /&gt;B.sh&lt;BR /&gt;echo $XYZ&lt;BR /&gt;&lt;BR /&gt;B.sh&lt;BR /&gt;------&lt;BR /&gt;export XYZ=30&lt;BR /&gt;&lt;BR /&gt;but I can NOT run the B.sh in the same shell using this way like ". ./B.sh" in the A.sh script.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Vasu&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Jun 2002 08:06:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752286#M834833</guid>
      <dc:creator>Vasudevan MV</dc:creator>
      <dc:date>2002-06-26T08:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: export Variable problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752287#M834834</link>
      <description>I believe the only way to do this is export the variable to a file and then in the parent sell check for the file and load the variable.&lt;BR /&gt;&lt;BR /&gt;A better way to do it is declare the variable first in the parent, then when it gets modified in the child it will also be set back in the parent.&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Jun 2002 08:13:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752287#M834834</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-06-26T08:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: export Variable problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752288#M834835</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;simple answer: you cannot.  The environment of a child process is lost when it exits.&lt;BR /&gt;&lt;BR /&gt;You will need to "source" the script if you want to keep the environment.  Why would you not use this option? :&lt;BR /&gt;. /dir/B.sh&lt;BR /&gt;&lt;BR /&gt;Other tricks are to put the value in a temp file and read it, put the export command in a temp file and source it, ....&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Thierry.</description>
      <pubDate>Wed, 26 Jun 2002 08:17:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752288#M834835</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2002-06-26T08:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: export Variable problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752289#M834836</link>
      <description>Hi Vasu,&lt;BR /&gt;&lt;BR /&gt;If you need only one value to be returned to the parent shell, you can do it by the exit from the child script like that:&lt;BR /&gt;&lt;BR /&gt;A.sh &lt;BR /&gt;----- &lt;BR /&gt;export XYZ=10 &lt;BR /&gt;sh B.sh&lt;BR /&gt;XYZ=$?&lt;BR /&gt;export XYZ&lt;BR /&gt;echo $XYZ &lt;BR /&gt;&lt;BR /&gt;B.sh &lt;BR /&gt;------ &lt;BR /&gt;export XYZ=30 &lt;BR /&gt;exit $XYZ&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Justo.</description>
      <pubDate>Wed, 26 Jun 2002 08:21:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752289#M834836</guid>
      <dc:creator>Justo Exposito</dc:creator>
      <dc:date>2002-06-26T08:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: export Variable problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752290#M834837</link>
      <description>Hi Vasudevan,&lt;BR /&gt;&lt;BR /&gt;*No way*, you can't do this, exporting works only in one direction, from parent processes to child processes, not the other direction. You have to put the value into a file which you read in parent process later to make the value existent here.&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Wed, 26 Jun 2002 08:33:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/export-variable-problem/m-p/2752290#M834837</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-26T08:33:07Z</dc:date>
    </item>
  </channel>
</rss>

