I'm working on a vpn script I've forked and I want to add a dialogue option so that it takes user input separated by space, and then echo the input with some nested settings text into the vpn server.conf file.
I'm not a programmer, but I really like bash and this is driving me nuts.
The script part
They're the same.
http://pastebin.com/raw/U0tSNaCP
The bottom two lines are just for echoing the result while testing.
Now, the issue I'm having is this part:
echo 'push "dhcp-option DNS $(echo $i)"' >> ./server.conf;
I've also tried the following and its variants with moving quotes around:
echo 'push "dhcp-option DNS $i"' >> ./server.conf;
But that doesn't work as it echoes $i
as text.
No matter how I try to nest the $i
variable, bash only echoes it as text, instead of user's input.
Examples of openvpn's configuration:
openvpn.net/index.php/open-source/documentation/howto.html#examples
;push "dhcp-option DNS 10.8.0.1"
;push "dhcp-option WINS 10.8.0.1"
So in the end, all I would like is a result like this:
push "dhcp-option DNS 1.2.3.4"
push "dhcp-option DNS 5.6.7.8"
where 1.2.3.4 and 5.6.7.8 and so on are user input. However, the quotes around the dhcp-option make nesting difficult.
Anyone got a better way to do this?
I've tried many and searched for nesting before asking this.
Thank you.