Changing environment variables in a shell script?

Matt Galvin matt.t.galvin at gmail.com
Thu Apr 28 20:17:45 UTC 2005


Easy way,

$ source <your_script>

Matt

On 4/28/05, Chuk Goodin <chukgoodin at gmail.com> wrote:
> I'd like to change an environment variable by running a script and then have
> it stay changed after the script has stopped running. My script is very
> simple:
>  
>  #!/bin/bash
>  DISPLAY=opal:1
>  export DISPLAY
>  
>  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?
>  
> thanks in advance,
>  
>  
> -- 
> chuk 
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> http://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> 
> 
>




More information about the ubuntu-users mailing list