In this GitHub repository I have a directory named
nwsm. This directory contains the file
nwsm.sh that contains a master script (a script that runs other scripts).
The directory also contains a few other files which contain sub-scripts that the master script executes, each one at a time.
nwsm.sh I declare a few variables and these variables should eventually be used inside all aforementioned subscripts. Variable expansion in both
nwsm.sh and subscripts should take place the same way, only in their execution.
Note that the directory doesn't contain any other files besides
nwsm.sh and its sub script files, nor that it should contain other files, at any time in the future.
Variable expansions inside the subscripts should occur with the relevant values defined in
nwsm.sh started to run.
This is the master script in
nwsm.sh (first the variable declarations with the
read utility, then the execution of the adjacent files):
#!/bin/bash domain="$1" && test -z "$domain" && exit 2 read -sp "Please enter DB root password: " dbrootp_1 && echo read -sp "Please enter DB root password again:" dbrootp_2 && echo if [ "$dbrootp_1" != "$dbrootp_2" ]; then echo "Values unmatched" && exit 1 fi read -sp "Please enter DB user password: " dbuserp_1 && echo read -sp "Please enter DB user password again:" dbuserp_2 && echo if [ "$dbuserp_1" != "$dbuserp_2" ]; then echo "Values unmatched" && exit 1 fi "$PWD"/tests.sh "$PWD"/wp-cli.sh "$PWD"/nginx.sh "$PWD"/dbstack.sh "$PWD"/certbot.sh
How could I ensure that values defined in
nwsm.sh will be available to all its counterparts while
.nwsm, and them, are running?