I have something like this...
I have three files.
two files which contains same variables but different values and a third file which executes commands such as cd to a certain place
my third file is called init.sh and looks something like
###############
# works perfectly if I do it this way
source db/abc.sh # changes variable
source db/commands.sh
source db/def.sh # changes variable
source db/commands.sh
###############
# does not work
RUN_COMMANDS=$(source db/commands.sh)
source db/1107556.sh # changes variable
${RUN_COMMANDS} # this does not run
source db/kunyuan.sh # changes variable
${RUN_COMMANDS} # this runs
Reason I am doing this is so I can change the variables then run the same commands since the commands are the same but just different values for the variable.
Hopefully I am not doing anything stupid to think this way of using bash.
Thanks in advance for any help or suggestions.