#!/usr/bin/expect -- set host [lindex $argv 0] set pass [read stdin] set timeout 600 spawn scp /root/.sshscript root@$host:/root/.sshscript expect word: { puts "Sending Password\n"; sleep 1 send "$pass\r" } expect 100: { puts "got 100\r"; }