I'm creating bash scripts to copy files search errors etc. from all our test servers.
I want to create an input file for these servers because they’re all test systems so they change hostname and IP from time to time.
Currently, I have to change all scripts if a server is changed.
I want one input file so I only have to change it there. So I only have to change the input file.
My input file I have created looks like this:
#!/bin/bash
SERVER1=$(echo "node1.example.com")
SERVER2=$(echo "node2.example.com")
etc.
I have tried
export file="path/to/input/file"
and also
read file="path/to/input/file"
but it doesn't work.
Now I want to read the values $SERVER1
, $SERVER2
, etc. into my other scripts.
How can I do that?
echo
is redundant. You can write justSERVER1=node1.example.com
. – Melebius Sep 07 '17 at 09:32