here is my "remote change passwd" script:
----------
#!/usr/bin/expect -f
#
set force_conservative 0
#
set timeout 1
spawn ssh root@srv
match_max 100000
expect "Last login: *\r\r
\]0;root@srv:~\[root@srv root\]# "
send -- "passwd USR\r"
expect "passwd*\r
Changing password for user *.\r
New password: "
send -- "PWD\r"
expect -exact "\r
Retype new password: "
send -- "PWD\r"
expect -exact "\r
passwd: all authentication tokens updated successfully.\r
\]0;root@mail:~\[root@mail root\]# "
send -- "/home/vpopmail/bin/vpasswd
USR@domain.com\r"
expect "/home/vpopmail/bin/vpasswd *\r
Please enter password for*: "
send -- "PWD\r"
expect -exact "\r
enter password again: "
send -- "PWD\r"
expect -exact "\r
\]0;root@mail:~\[root@mail root\]# "
send -- "exit"
....
--------------------
This works great if I fill the values for USR & PASS in the script.
How can I pass these from the command prompt like:
#./myscript.exp USR PASS
and make the script use these
Thank you for the support