I have several shell scripts that I summarised within a global script. I am using some variables that are the same across all scripts, and I wrote a separate script for this, which I am sourcing in each sub-script.This is what my variables script looks like:variables.shNUMBER=6TYPE=${NUMBER}_xyzSTATE=S05DIR=path/file_${NUMBER}_blablaFILE=file.txtMy global script, global.sh, looks like this:source variables.shbash script1.shbash script2.sh...Now, I need to change the NUMBER variable in my variables script, run the global script, change the number, run the global script again etc. for each number from 6-15. At the moment I am doing this manually every time the global script has finished, but it's taking up a lot of time. Has someone got an easy to implement tip for a newbie?Thanks in advance!
Sourcing scripts with a for loop for different variables
shell script;environment variables
First you have to adapt variables.sh so that NUMBER is not set unconditionally any more:NUMBER=${NUMBER:-6}That allows you to pass the value from the calling process:for((NUMBER=6;NUMBER<16;NUMBER++)); do  source variables.sh  bash script1.sh  bash script2.shdoneGeneral remark: I am surprised that this works without export statements or set -a.