>What happens if I want to reference them in another script after
A concept of sub shell(s) exists here. IOW perhaps think parent--child. IOW any shell in which you set and export vars is at first the parent until your script has been launched -- script, however, (when launch it) launches in a sub shell (another shell, child to where you started at).
So, set and exported vars are available at any time (key

*from said child shell*. Also key: once your script ends/quits, its child shell it ran in also closes out or terminates -- and now if you launch another script, the vars from the first script are gone, no longer able to reference.
So, either put two scripts into one script (all runs in the SAME child shell ie no referencing problem).
Or, if you need vars avail in your evironment (globally) then thats what .bash_profile and .bashrc user config files are for.
I've a way that works. Not sure if I got it the best way thats available. I modify var in .bashrc and in .bash_profile I source the .bashrc -- thus:
# begin .bash_profile:
# 3-10-2005 user al bash settings
# System wide aliases and functions /etc/bashrc (/etc/profile.d).
# Personal startup programs should go into ~/.bash_profile.
# Personal aliases and functions and environment
# variables should go into ~/.bashrc
[ -f /etc/profile ] && . /etc/profile
[ -f ~/.bashrc ] && . ~/.bashrc
# end of .bash_profile
only 2 lines there in my .bash_profile -- each line sources the config from yet another file -- each of those 2 lines says: if (find/exist a/said file) on left then on right the dot means source the file on the right. In that way, both of those two files get sourced into my ~/.bash_profile
Here's my ~/.bashrc:
# 3-10-2005 user al bash settings
# System wide aliases and functions /etc/bashrc (/etc/profile.d).
# Personal startup programs should go into ~/.bash_profile.
# Personal aliases and functions and environment
# variables should go into ~/.bashrc
[ -f /etc/profile ] && . /etc/profile
export PATH=$PATH:/home/al/bin
biff n
alias cdr='sudo /home/al/bin/cdrecordeasy'
alias cmx='chmod u+x'
alias cups='sudo /usr/local/bin/cups.sh'
alias diskck='du -s -k -c * | sort -rn'
alias firew='sudo /usr/local/bin/firehol'
alias hi='history'
alias hig='history | grep'
alias httpd='sudo /usr/sbin/apachectl'
alias fm='fetchmail -k'
alias fmorig='fetchmail -k -l 50275'
alias fmck='tail /var/tmp/fetchmail.log'
alias lsag='ls -la | grep'
alias lsg='ls | grep'
alias newsdl='sudo slrnpull -h news.server.com'
alias newsr='slrn --spool -i ~/.slrnrc_spool -f ~/.jnewsrc_pull'
alias prnsrv='sudo /sbin/arp -s -v 192.168.0.102 00C002505653'
alias prnsrvck='ping -c 4 192.168.0.102'
alias mntcd='mount /mnt/cdrom'
alias umntcd='umount /mnt/cdrom'
alias mntflp='mount /mnt/floppy'
alias umntflp='umount /mnt/floppy'
# end of .bashrc
my modified (appended to) PATH variable is available to me (globally) in any shell that I (I'm a user: al) open (or log into).
This is on Slackware 10.2
Similarities exist amongst distros, but filenames and locations may somewhat differ.
Alan.