# getting variable from script

**URL:** <https://community.unix.com/t/getting-variable-from-script/147012>\
**Category:** UNIX for Dummies Questions & Answers\
**Created:** [October 21, 2003, 6:04am UTC](https://community.unix.com/t/getting-variable-from-script/147012 "2003-10-21T06:04:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vascobrito](https://community.unix.com/letter_avatar/vascobrito/32/6_449c533f586939b6e5f246632a46421f.png) [@vascobrito](https://community.unix.com/u/vascobrito)\
**Post date:** [October 21, 2003, 6:04am UTC](https://community.unix.com/t/getting-variable-from-script/147012/1 "2003-10-21T06:04:56Z")

</div>

Hi there  
I'm absolutly new in this and i'm very confused allready.  
I need to run a script from .profile , wich has no problem and when i return to .profile (this script runs from the middle of the .profile), i need to get a variable set on the scipt file.  
I have puted this line in the end of the script :

export LOGT

and this is the value i need to get when returning to .profile.

How can i do this?

---

<div class="post-metadata">

**Author:** ![Perderabo](https://community.unix.com/user_avatar/community.unix.com/perderabo/32/27_2.png) [@Perderabo](https://community.unix.com/u/Perderabo)\
**Post date:** [October 21, 2003, 7:22am UTC](https://community.unix.com/t/getting-variable-from-script/147012/2 "2003-10-21T07:22:05Z")

</div>

Your script is a seperate process launched by your .profile. When it exits, its environment goes away, including the exported variable. A child process cannot change the environment of its parent.

Try this...  
instead of  
script  
do this  
. script

A dot script runs in the same process.
