Possible Duplicate:How can I make variables “exported” in a bash script stick around? I have a problem with executing script from file. When I type in command line PATH=$PATH:/home/then PATH is changed appropriately. But when I execute this file :#!/bin/sh#provided by mePATH=$PATH:/home/echo doneexit 0done is printed but PATH is not changed. Why is this happening ? 
Shell script executing in the terminal but not from shell script file
bash;shell;shell script;environment variables
Environmental variable changes apply to the current process and any subsequent children, but not to parent processes.  So if you run a script, it cannot affect the environmental variables of the shell that ran it.  You need to source the script using the . shell builtin.  I.e.. /path/to/scriptThis causes the current shell to execute the commands in the file instead of running a subprocess.