linux - Why doesn't a shell get variables exported by a script run in a subshell?
I have two scripts 1.sh and 2.sh.

If you are executing your files like sh 1.sh or ./1.sh Then you are executing it in a sub-shell. 
If you want the changes to be made in your current shell, you could do:
. 1.sh
# OR
source 1.sh

Please consider going through the reference-documentation.
"When a script is run using source [or .] it runs within the existing shell, any variables created or modified by the script will remain available after the script completes. In contrast if the script is run just as filename, then a separate subshell (with a completely separate set of variables) would be spawned to run the script."
