<?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: env variable from a script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525253#M17060</link>
    <description>My thought is that this is not suppose to work this way.&lt;BR /&gt;&lt;BR /&gt;As stated, I make a file called 'test' and in this file I put 'CITY=LA;export CITY'. I cannot get the $CITY value.&lt;BR /&gt;&lt;BR /&gt;If I rename this file to .test (same contents) and execute this file the env variable of `echo $CITY` is LA.&lt;BR /&gt;&lt;BR /&gt;As stated, I do not believe this correct is how it works.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 14 Apr 2005 15:40:06 GMT</pubDate>
    <dc:creator>Rick Garland</dc:creator>
    <dc:date>2005-04-14T15:40:06Z</dc:date>
    <item>
      <title>env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525249#M17056</link>
      <description>How can I set an environment variable or alias, from inside a shell script?&lt;BR /&gt;&lt;BR /&gt;I put the export command or the alias command but it does not works.&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Apr 2005 14:09:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525249#M17056</guid>
      <dc:creator>Tonatiuh</dc:creator>
      <dc:date>2005-04-14T14:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525250#M17057</link>
      <description>Which shell is being used for the script? Different shells have different methods for setting env variables.&lt;BR /&gt;&lt;BR /&gt;Example, csh vs bash</description>
      <pubDate>Thu, 14 Apr 2005 14:29:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525250#M17057</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-04-14T14:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525251#M17058</link>
      <description>Red Hat Enterprise Linux. Bash Shell</description>
      <pubDate>Thu, 14 Apr 2005 14:39:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525251#M17058</guid>
      <dc:creator>Tonatiuh</dc:creator>
      <dc:date>2005-04-14T14:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525252#M17059</link>
      <description>This is a strange one. &lt;BR /&gt;&lt;BR /&gt;If I try to set an env variable at command line it works. If I set an env from a '.' file it works. If I set an env variable from regular file it doesn't work&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Apr 2005 15:24:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525252#M17059</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-04-14T15:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525253#M17060</link>
      <description>My thought is that this is not suppose to work this way.&lt;BR /&gt;&lt;BR /&gt;As stated, I make a file called 'test' and in this file I put 'CITY=LA;export CITY'. I cannot get the $CITY value.&lt;BR /&gt;&lt;BR /&gt;If I rename this file to .test (same contents) and execute this file the env variable of `echo $CITY` is LA.&lt;BR /&gt;&lt;BR /&gt;As stated, I do not believe this correct is how it works.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Apr 2005 15:40:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525253#M17060</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-04-14T15:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525254#M17061</link>
      <description>A child cannot set the environment of a parent.&lt;BR /&gt;&lt;BR /&gt;In bash, you call an alias or a script.. it spawns off a sub-shell.  The subshell protect's the parents environment space.&lt;BR /&gt;&lt;BR /&gt;Most (if not all) linux based shells do this for security reasons.  There are a few that don't (some versions of pdksh for instance).&lt;BR /&gt;&lt;BR /&gt;To set the environment in the current shell, you either have to use '. &amp;lt;script&amp;gt;' commands, or set them manually.&lt;BR /&gt;&lt;BR /&gt;What exactally are you trying to do?</description>
      <pubDate>Thu, 14 Apr 2005 19:55:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525254#M17061</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2005-04-14T19:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525255#M17062</link>
      <description>execute the env variable script using &lt;BR /&gt;&lt;BR /&gt;. ./test</description>
      <pubDate>Fri, 15 Apr 2005 05:25:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525255#M17062</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2005-04-15T05:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525256#M17063</link>
      <description>This is what I want to do.&lt;BR /&gt;&lt;BR /&gt;I want a script which can change several environment variables. And I want to invoke this scripts from everywhere I was in the directory hierarchie.&lt;BR /&gt;&lt;BR /&gt;This is, wherever I am, I want to change several (defined) environment variables just typing a single word (command, name of the scripts, etc.).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Apr 2005 10:16:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525256#M17063</guid>
      <dc:creator>Tonatiuh</dc:creator>
      <dc:date>2005-04-15T10:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: env variable from a script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525257#M17064</link>
      <description>Use a shell 'FUNCTION'.&lt;BR /&gt;&lt;BR /&gt;In your profile/bash profile, set up the function do do what you require:&lt;BR /&gt;&lt;BR /&gt;function name() {&lt;BR /&gt;  command&lt;BR /&gt;  command&lt;BR /&gt;  command&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;And run 'name' when you need it.  It changes the current shell's environment.&lt;BR /&gt;&lt;BR /&gt;See 'man bash', the secion on 'FUNCTIONS'.</description>
      <pubDate>Fri, 15 Apr 2005 18:36:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/env-variable-from-a-script/m-p/3525257#M17064</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2005-04-15T18:36:51Z</dc:date>
    </item>
  </channel>
</rss>

