Due to my laziness, I have written an extremely messy series of scripts in order to auto-initiate my openvpn. The configuration file I am using comes vpnbook.com/freevpn. To get the password I use:lynx --dump --nolist vpnbook.com/freevpn | grep -i password | sort -u | cut -b 18,19,20,21,22,23,24The password is returned from the website.Then, I use an expect script to automatically login (the user name is always vpnbook, but the password changes depending on the week):#!/usr/bin/expect -fspawn openvpn /vpn/vpnbook-ca1-tcp80.ovpn ### my vpn configuration file ###expect *?sername:*send -- vpnbook\rexpect *?assword:*### This next line sends the password that changes by the week, which I...###...unfortunately need to update manually (for lack of a better method):send -- weekly-password\r The problems I am running into when attempting to automatically update the password:1) I can't call lynx directly from the expect environment.2) Since the password changes, I am not certain how to replace thethe unique pass-phrase from the previous week with the updated version in :  send -- unique-previous-password\r 3) I am not certain how use the string output from the lynx function as an input variable for editing the password from the previous week (located in my expect script).Quite clearly, I am not the brightest programmer (nor am I the most efficient). However, at the end of the day, my only goal is to fully initialize my vpn by typing a single command (as I mentioned before, I am lazy). Any help would be appreciated, thanks!
How can I update a unique string in a shell-script with the output of a seperate function?
shell script;text processing;string;output;expect
In your expect/tcl script, you can use:send $env(PASSWORD)\rAnd call your expect script with with:PASSWORD=$(elinks -dump...) /path/to/your/expect/scriptNote that you can use cut -b18-24 for short.