My objective is to create a list of variables that can be called or referenced by any test script that is being executed.  There are a lot of test scripts on the system but the variables are convoluted and hard to understand. For each type of setup, there are different variable names for the same thing. I want to rename the variables and modify the test scripts to reference to the same variables so it's easier to understand.Here is an example of how one variable is defined in a script:RightNumberOfDevices=$( lspci -n | egrep --count 8086:[[xdigitx]][xxdigit]][[:xdigit:]][[:xdigit:]] )In another script, I'll see this:TotalNumberOfDevices=$( lspci -n | egrep --count 8086:[[xdigitx]][xxdigit]][[:xdigit:]][[:xdigit:]] )I want to be able to declare TotalNumberOfDevices in some kind of startup script so that the value in that variable can be accessed throughout the environment.This is the code that I'm trying to implement:ethcounter=$(ifconfig -a | egrep --count eth[0-9]+)ethindex0=$((ethcounter-1))declare -a eth                  #This declares that eth is an array variablefor ((i=0; i<=ethindex0; i++)) do        eth[$i]=$(ifconfig eth$i | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' )        echo eth[$i] = ${eth[$i]}        set ${eth[$i]} doneAll I'm trying to do is store the IP addresses of each Ethernet device and make them available to other scripts.
Exporting Variables and setting Global Variables in Bash
linux;bash;shell script