What I am doing is this:
I would like to divide my script into multiple chunks. What would the best practice be for defining all of my variables in one place? Should I define them all in the init script and export or is there a better way to have each piece of my script look to one static variables file? Maybe in JSON or the like? Here's an example
project/main.sh
#!/bin/bash
new_user="poopmacscoop"
a_list_of_packages="pyhon3 nmap apache2.... others"
some_other_info_for_another_script="important info"
menu () {
read # blah blah whatcha wanna run?
# other bits
}
opts () {
case ... # a bunch of options
1) ./src/another_script.sh # one of a bunch of scripts in a separate folder
}
while true
do
menu
opts
done
Now in the ./src/another_script.sh script, what is the best way to deal with the vars for ease and jump-around-ability? (that's a technical term)
new_userorsome_other_infowhile the software is running, do you?