Bash Shell Scripting Dynamic Variable naming question
I'm trying to name a variable dynamically such that the name is the contents of another variable plus some text.
I want to create variable called "http://10.0.0.1DOWN" using the $SITE variable and then assign some value to it.
but of course that doesn't work. I get
bash: http://10.0.0.1DOWN=no: command not found.
How do I get it right?
Know two things.
First, a symbol in bash may not contain colons, slashes, or periods. Period. I recommend you change them all to underscores, or get rid of them altogether.
Second, bash can get confused if you do something like
no matter what the current value of $SYMBOL is. You can get around that by using the "set" command (or the "export" command if you wish this symbol to be accessible by programs you run after that).
I recommend you play with something like this:
This is generally doable, but you first need to use a valid variable name, and "http://10.0.0.1DOWN" is not.
That one would work:
|All times are GMT -5. The time now is 09:54 AM.|