combine bash & expect with variable from user input
I've tried to combine bash script and expect without any success...
can someone point me what is wrong here ?
rm -rf /tmp/*log*
expect -c "
spawn /usr/bin/ssh -l username [lindex $argv 0]\n
send "print os date\n"
send "print os time\n"
sed -i 's/\r$//g' log
here's the output i get when i run :
#./myscript 10.10.10.1 > log
without redirect to log file it look like this :
spawn /usr/bin/ssh -l username 0
The authenticity of host '0
(0.0.0.0)' can't be established.
RSA key fingerprint is 2c:6e:2a:d6:d0:43:73:06:95:be:82:8e:83:1d:a1:cf.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '0
' (RSA) to the list of known hosts.
Permission denied, please try again.