I created a very simple bash script. The first line of the script after #!/bin/bash accesses my vpn service using an OPENVPN file provided by the VPN Vendor. It works as expected and then waits for data entry of my username and once entered expects my password.
I used the echo command to provide the required responses but they never occur. Open VPN just sits there waiting for my username. If I hit enter twice then OPENVPN terminates and my script completes by echoing the username and password.
#!/bin/bash
sudo openvpn /etc/openvpn/us-dtw.prod.xxxxxxx.com_udp.ovpn
echo $'\r'
printf " xf3Z3ZY6xxxxxxxxEuRDmh"
echo $'\r'
echo " nvn7B5kxxxxhxxJstRU"
What could be causing my script to hang and not execute the echo commands until OPENVPN terminates?
Maybe there is a way to pipe the text but I am really new to this.
Found an example that works correctly to automate the VPN logon process: https://help.anonine.com/support/solutions/articles/5000613671-how-do-i-save-my-username-password-in-openvpn-for-automatic-login-