<?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: Environment variable setup using export failed to setup env variables in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069374#M30001</link>
    <description>As menthined by Oviwan, the problem is that the variables are set into a new shell (#!/bin/bash), then the script finishes and the shell ends.&lt;BR /&gt;&lt;BR /&gt;To avoid this, and set the variables to your current shell, remove the first line and run:&lt;BR /&gt;&lt;BR /&gt;. shell.sh&lt;BR /&gt;&lt;BR /&gt;This is dot, space, shell.sh. Or you can use:&lt;BR /&gt;&lt;BR /&gt;source shell.sh&lt;BR /&gt;&lt;BR /&gt;This will load the variables into your current shell.</description>
    <pubDate>Wed, 12 Sep 2007 08:52:17 GMT</pubDate>
    <dc:creator>Ivan Ferreira</dc:creator>
    <dc:date>2007-09-12T08:52:17Z</dc:date>
    <item>
      <title>Environment variable setup using export failed to setup env variables</title>
      <link>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069372#M29999</link>
      <description>HI,&lt;BR /&gt;&lt;BR /&gt;I have a short script below to set some environment variables. &lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;export GATEWAY_ROOT=/prodkl/working/huawei_nss/V33&lt;BR /&gt;export GATEWAY_FRAMEWORK=/prodkl/working/GATEWAY_FRAMEWORK&lt;BR /&gt;export GATEWAY_CONFIG=/prodkl/working/3rd_LINE/huawei_nss/V33/GATEWAY_CONFIG&lt;BR /&gt;export VENDOR_GATEWAY=/prodkl/working/3rd_LINE/huawei_nss/V33/VENDOR_GATEWAY&lt;BR /&gt;export PERL5_BASE=/prodkl/working/3rd_LINE/PERL5_BASE&lt;BR /&gt;export TZ=GMT+8&lt;BR /&gt;&lt;BR /&gt;However, executing the script does not seem to set the environment variables. &lt;BR /&gt;bash-3.00$ echo $TZ&lt;BR /&gt;&lt;BR /&gt;bash-3.00$ echo $GATEWAY_CONFIG&lt;BR /&gt;&lt;BR /&gt;bash-3.00$ echo $VENDOR_GATEWAY&lt;BR /&gt;&lt;BR /&gt;bash-3.00$ echo $GATEWAY_ROOT&lt;BR /&gt;&lt;BR /&gt;May I understand where did go wrong?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Danny.</description>
      <pubDate>Wed, 12 Sep 2007 06:53:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069372#M29999</guid>
      <dc:creator>Danny Fang</dc:creator>
      <dc:date>2007-09-12T06:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable setup using export failed to setup env variables</title>
      <link>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069373#M30000</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;just source this file but remove the #!/bin/sh line before.&lt;BR /&gt;&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;. /path/toyourfile/filename&lt;BR /&gt;&lt;BR /&gt;now you can do echo $TZ&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 12 Sep 2007 08:08:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069373#M30000</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-09-12T08:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable setup using export failed to setup env variables</title>
      <link>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069374#M30001</link>
      <description>As menthined by Oviwan, the problem is that the variables are set into a new shell (#!/bin/bash), then the script finishes and the shell ends.&lt;BR /&gt;&lt;BR /&gt;To avoid this, and set the variables to your current shell, remove the first line and run:&lt;BR /&gt;&lt;BR /&gt;. shell.sh&lt;BR /&gt;&lt;BR /&gt;This is dot, space, shell.sh. Or you can use:&lt;BR /&gt;&lt;BR /&gt;source shell.sh&lt;BR /&gt;&lt;BR /&gt;This will load the variables into your current shell.</description>
      <pubDate>Wed, 12 Sep 2007 08:52:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069374#M30001</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2007-09-12T08:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable setup using export failed to setup env variables</title>
      <link>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069375#M30002</link>
      <description>Hi Danny:&lt;BR /&gt;&lt;BR /&gt;The key is to source (read) your script but not run it as a separate shell where its variables cannot be seen or propagated to parent shell.&lt;BR /&gt;&lt;BR /&gt;Hence:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;echo "I am the parent script"&lt;BR /&gt;. myenv.sh #...NOTE the DOT then WHITESPACE followd by the file name!&lt;BR /&gt;echo "my GATEWAY_ROOT is ${GATEWAY_ROOT}"&lt;BR /&gt;&lt;BR /&gt;This is WRONG:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;myenv.sh&lt;BR /&gt;echo "my GATEWAY_ROOT is ${GATEWAY_ROOT}"&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 12 Sep 2007 09:04:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/environment-variable-setup-using-export-failed-to-setup-env/m-p/4069375#M30002</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-12T09:04:12Z</dc:date>
    </item>
  </channel>
</rss>

