I am making a script which reads variables from another file. I have accomplished almost all the tasks, only unable to complete one.
What i am doing is that the user will enter IP Address Ranges seperated by space in a variable IP like this
Code: Select all
echo Please Enter IP Ranges Seperated By Space.
read IP
echo -e "IP=$IP" >> /scripts/firewall/firewall.conf
Now the file /scripts/firewall/firewall.conf looks like
Now the file which is retrieving the variables from /scripts/firewall/firewall.conf has code similar to.IP=10.10.10 10.10.11 10.10.12
Code: Select all
cat /scripts/firewall/firewall.conf | awk '/IP/' | cut -d"=" -f2
What i want to do is that count the IP Ranges enter by the user.
In the above example like i enter 3 IP Ranges.
Now what my script should do is that count the IP Ranges and create Variables like IP1 IP2 IP3 and so on till the number of IP Ranges reaches, and each IP Range should have the Range Entered by the User like IP1=10.10.10 IP2=10.10.11 IP3=10.10.12
How can i achieve this.
Looking Forward For Your Replies.