#!/usr/bin
#read the input parameters
set cmd1 [lindex $argv 0];
set cmd2 [lindex $argv 1];
set usr [lindex $argv 2];
set pwd [lindex $argv 3];
set ip [lindex $argv 4];
#sftp to specified host and send the files
spawn ssh $ip
expect
{
"Password:"
{
send "$pwd\r"
expect
{
"ssh*"
{
send "ls -l\r"
set timeout -1
send "quit\r"
expect eof
exit 0
}
}
}
}
# timed out
puts "\nError connecting to server: $ip, user: $usr and password: $pwd!\n"
exit 1
Hi, Im new to perl scripting.. read through books and through net, i have developed a above coding named first.pl..... when i run, i got..
$ ./first.pl ssh -l user password ipaddress
./first.pl[9]: spawn: not found
expect1.1>_
help me to proceed.... Thanks a lot