Changing environment variables in a shell script?
Chuk Goodin
chukgoodin at gmail.com
Fri Apr 29 01:40:38 UTC 2005
On 4/28/05, Magnus Therning <magnus at therning.org> wrote:
>
> >After running it, my DISPLAY variable is unchanged. If I just type the
> >last two lines (one at a time) into the command prompt, it works. Also,
> >if I check the DISPLAY variable from within the script, it shows up as
> >what I want it to be. How do I get it to change my "main" environment
> >variable?
>
> You can do what you want by 'sourcing' your script:
>
> $ source script
>
> or
>
> $ . script
>
> Executing the script starts a new shell and your script is run inside it
> leaving the environment of the original shell untouched. This beahviour
> is different from MS-DOS.
Thanks to all who answered, that's exactly what I needed!
--
> chuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050428/32561064/attachment.html>
More information about the ubuntu-users
mailing list