In bash:
#!/bin/bash
expect -c "
spawn ssh root@1.1.1.1
expect password:
send \"1234\r\"
expect ]#
send \"ls -l\r\"
expect ]#
send \"uname -r\r\"
expect -timeout 1
"
Not in bash:
#!/usr/bin/expect
spawn ssh root@1.1.1.1
expect "password: "
send "1234\r"
expect "]# "
send "uname -r\r"
expect -timeout 1