Here is the script :
===
#!/bin/bash
HOST="remote-hostname"
USER="remote-user"
PASS="remore-user-password"
CMD=$@
VAR=$(expect -c "
spawn ssh -o StrictHostKeyChecking=no $USER@$HOST $CMD
match_max 100000
expect \"*?assword:*\"
send -- \"$PASS\r\"
send -- \"\r\"
expect eof
")
echo "==============="
echo "$VAR"
===
Try :)
Sunday, 24 October 2010
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment