# Re: export environment variable

**URL:** <https://www.ruby-forum.com/t/re-export-environment-variable/71028>\
**Category:** Ruby\
**Created:** [October 4, 2006, 7:39pm UTC](https://www.ruby-forum.com/t/re-export-environment-variable/71028 "2006-10-04T19:39:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [October 4, 2006, 7:39pm UTC](https://www.ruby-forum.com/t/re-export-environment-variable/71028/1 "2006-10-04T19:39:03Z")

</div>

Mohammad K. wrote:

> I would like to accomplish something like this in a ruby script
> 
> export RUBYLIB=$HOME/MyLib/

ENV[‘RUBYLIB’] = File.expand\_path(’~/MyLib/’)

Gennady.

---

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [October 4, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/re-export-environment-variable/71028/2 "2006-10-04T19:57:04Z")

</div>

This is going to be local to the script.  
I want something like, global.

Mohammad

Gennady B. wrote:

> 

–  
Mohammad K. | Software Engineer  
Lextranet | 107 Union Wharf | Boston, MA 02109  
[http://www.lextranet.com](http://www.lextranet.com)  
(617) 227-4469 Extension 218

Smart Tools. Smart Team. Smart Choice.

THE INFORMATION IN THIS MESSAGE IS INTENDED ONLY FOR THE PERSONAL AND  
CONFIDENTIAL USE OF THE DESIGNATED RECIPIENTS NAMED ABOVE AND MAY  
CONTAIN LEGALLY PRIVILEGED INFORMATION. If the reader of this message  
is not the intended recipient or an agent responsible for delivering  
it to the intended recipient, you are hereby notified that you have  
received this document in error, and that any review, dissemination,  
distribution or copying of this message is strictly prohibited. If  
you have received this communication in error, please notify us  
immediately by telephone at 617-227-4469 Ext. 200. Thank you.

---

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [October 4, 2006, 8:11pm UTC](https://www.ruby-forum.com/t/re-export-environment-variable/71028/3 "2006-10-04T20:11:06Z")

</div>

On 10/4/06, Mohammad K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This is going to be local to the script.  
> I want something like, global.

As far as I know, you can’t do that even in bash (that = export  
variables from a subshell to the parent).

J.
