On Wed, Jan 09, 2002 at 02:47:47PM +0100, Sebastiaan wrote: | Hi, | | I wrote a little bash script, but I ran into a problem: I need to export a | variable out of the bash scipt into the shell. Shortly, it comes to this: | | #!/bin/sh | # | DISPLAY=:1 | export DISPLAY | | | When I execute this script, the value is set correctly in the script | environment, but after execution 'echo $DISPLAY' still results the old | value. I have also tried 'set DISPLAY', without succes. Any hints?
The script runs in a subshell. Thus everything you do affects the subshell (which terminates when the script is finished) and you return to the same old shell you had before. Use a function in your .bashrc instead, or "source" the script (no need for the shebang then). (notice : this is the inverse of .bat files) -D -- Even youths grow tired and weary, and young men stumble and fall; but those who hope in the Lord will renew their strength. They will soar on wings like eagles; they will run and not grow weary, they will walk and not be faint. Isaiah 40:31