so I've this shell script, where i take simple user input of IPs and store that into a text file.
MasterNode(){
echo "Enter number of Master Node below"
read -r numESM
for ((i=1; i<=${numESM}; i++))
do
echo "${bold}Enter Master node server IP below${normal}"
read IPS;
echo "${IPS}" >> /path/Master.txt 2>&1
done
}
MasterNode
Master.txt output is this
1.1.1.1
2.2.2.1
1.1.2.1
and i want to save these IPs in this format into another file (configuration) file
discovery.seed_hosts: ["1.1.1.1", "2.2.2.1","1.1.2.1"]
cluster.initial_master_nodes: ["1.1.1.1","2.2.2.1"]
Is there any way by which I can store each value which I get in the loop into some dynamic variable like, when the loop runs first the value is stored in A[0] and A[0] have value 1.1.1.1 similarly A[1] which have value 2.2.2.1. then getting its value just like any other vairable in bash.