0
I’m building a connection script using expect
, spawn
, send
, etc.
My problem is time to enter the password.
The password I’m testing is test! Q@W#E$R, the problem that when I run it returns:
can't read "R": no such variable while executing "send "teste!Q@W#E$R""
I mean, he’s giving away right at the end, in the $R.
Does anyone know how I make him ignore the function of $ and consider it as part of the string?
Follows the script:
#!/usr/bin/expect -f
spawn /opt/forticlient-sslvpn/64bit/forticlientsslvpn_cli --server <IP>:<PORTA> --vpnuser <USER>
expect "Password for VPN:"
send $'teste!Q@W#E$R'
expect "*(Y/N)"
send "Y\r"
interact
I think the system is interpreting the
$
, tries to use like thissend 'teste!Q@W#E$R'
, with''
instead of""
– Denis Rudnei de Souza
Hi Denis, thank you for your attention. But I tested it here and it didn’t work either
– Lucas Moura
That’s what you’re looking for?
send $'teste!Q@W#E$R'
– Ronaldo Araújo Alves
Hi Ronaldo, good afternoon, thanks for answering.. but it hasn’t worked out yet can’t read "R": no such variable while executing "send $'test! Q@W#E$R'"
– Lucas Moura
It’s shell script you’re using, right?
– Ronaldo Araújo Alves
I sent the script in the comment below
– Lucas Moura
Tried to
send 'teste!Q@W#E$R'
? Without the$
– Ronaldo Araújo Alves
The script works, I tested with another user and password and was good
– Lucas Moura
yes, I also tested without the ' and the same
– Lucas Moura
i also saw that the same error occurs for passwords with *(asterisk)
– Lucas Moura