Script to scp every minute with plain password

Hello,

I have a Solaris x86 server. I am installing patch cluster on that. Out of so many patches, any one patch is breaking its LDAP authentication and I am not able to figure out, which one is that. I have restored server and planning to apply that patch cluster again.
To figure that patch, I got an idea. While patching is running, I would want to setup a cronjob in server2, which will run a scp job to copy something with my user-id (non-root), to this server, with time-stamp.

I need the script, which can be setup in cronjob of server2 and that will pull a file with scp with my user-id and LDAP password, with time-stamp. I would want to run it every minute. After patching, I will check time-stamp, when that scp was broke and I will check in logs, which patch was applied at that time.

I tried taking help of expect with below script

#!/usr/local/bin/expect -f
# ----------------------------------------------------------------------
# For example:
#  ./sshlogin hostname username password who
#  ./sshlogin hostname username password uname -a
# ----------------------------------------------------------------------
# set Variables
set hostname [lrange $argv 0 0]
set username [lrange $argv 1 1]
set password [lrange $argv 2 2]
set scriptname [lrange $argv 3 3]
set arg1 [lrange $argv 4 4]
set timeout 20
# now connect to remote UNIX box (ipaddr) with given script to execute
spawn ssh -q -o NumberOfPasswordPrompts=1 -o StrictHostKeyChecking=no $username@$hostname $scriptname $arg1
match_max 100000
# Look for passwod prompt
expect "*?assword:*"
# Send password aka $password
send -- "$password\r"
# send blank line (\r) to make sure we get back to gui
send -- "\r"
expect eof
catch wait reason
set exit_status [lindex $reason 3]
send_user "EXIT CODE: $exit_status\r"
exit $exit_status

But it doesn't give me expected value and ends up with some numeric ouput

bash-3.2# /var/tmp/ssh-test.sh nproc-db34-admin broe ZAQ!2wsx uname -a
/var/tmp/ssh-test.sh nproc-db34-admin broe ZAQuptimewsx uname -a
spawn ssh -q -o NumberOfPasswordPrompts=1 -o StrictHostKeyChecking=no broe@nproc-db34-admin uname -a
Password:
bash-3.2#  255

Assuming, it is not liking format of my password, with ! mark and numeric 2

bash-3.2# !2
uptime
  3:02pm  up 1 day(s),  1:42,  1 user,  load average: 0.01, 0.02, 0.02
bash-3.2#

Regards
----------------------------
I changed the shell to ksh and then it worked, so consider this thread as solved.