expectコマンドで圧縮先を指定してみる

#!/bin/sh

HENSU=$1

expect -c "
set timeout 10
spawn ssh kenken@$HENSU
expect \"s password:\"
send \"kenken\n\"
expect \"~]\"
send \"su -\n\"
expect \"パスワード:\"
send \"kenken\n\"
send \"tar zxvf /home/kenken/ruby-1.9.3-p327.tar.gz -C /home/kenken/\n\"
expect {
default {exit 2}
\"Successful\"
}
expect \"~]\"
"