how to run shell script inside expect script?

I have the code like this :

shell script continues ...
....
          expect -c"
          spawn telnet $ip
          expect "login:"
          send \"$usrname\r\"
          expect "Password:"
          send \"$passwd\r\"
          expect "*\>"
          send \"$cmdstr\r\"
          expect "*\>"
          send \"exit\r\"
          expect eof"
....  
shell script continues...

$cmdstr is the command i want to execute on the remote device.
There are several cmds to execute on the remote device,but i have to telnet several times to the device to execute them.
If I can write some shell script inside expect script,then ,it loop to execute each cmd after login in,so it will telnet only once each device to execute all the cmds on it.

Anyone can tell me how to write shell scripts inside expect scripts?
Or,if you get some other methods to telnet only once to execute all cmds.Pls tell me.

Thanks.:confused:

Can you just store the multiple commands inside an array ...

set cmdstr(0) "command1"
set cmdstr(1) "command2"
set cmdstr(2) "command3"
expect -c"
spawn telnet $ip
expect "login:"
send \"$usrname\r\"
expect "Password:"
send \"$passwd\r\"
expect "*\>"
for {set i 0} {$i<[array size cmdstr]} {incr i} {
    send "$cmdstr($i)\r"
    expect "*\>"
}
send \"exit\r\"
expect eof"