title: How to reload environment variable in shell script without restarting Linux server
body: <p>I want to set a environment variable globally for all users in linux.</p>
  
  <p>In order to do that I modified /etc/environment file.</p>
  
  <p>For example at the end of file.</p>
  
  <pre><code>sudo sh -c 'echo "\nmyenv=hello" &gt;&gt; /etc/environment'
  </code></pre>
  
  <p>After executing this command when in run in the same terminal.</p>
  
  <pre><code>echo $myenv
  </code></pre>
  
  <p>i'm not getting the value hello. </p>
  
  <p>After typing the below command.</p>
  
  <pre><code>source /etc/environment 
  </code></pre>
  
  <p>I'm able to access the environment variable in command prompt with </p>
  
  <pre><code>echo $myenv
  </code></pre>
  
  <p>But the problem in this method is if i execute a sh file. Which is accessing the $myenv. I need to again type the command<br>
  source /etc/environment in that shell script.</p>
  
  <p>Please let me know what is going wrong here.</p>
  
  <p>Please suggest me what is the approach followed here.</p>
  
  <p>I don't what to logoff and logon or restart my server.</p>