I'm running a debug command to log the output of my command to a file.I tried the log_file command but it doesnt log the output.My code is as follows:
log_file -a gdb.txt
send "~/debugulator.sh $file mns20\r"
log_user 0
expect -re {DSP.*0x[0-9][0-9][0-9][0-9]}
log_user 1
send_log $expect_out(0,string)
log_file
But when I open gdb.txt,nothing is inside.Can somebody tell me where exactly am I going wrong.The version of expect I'm using is 5.26.0
UPDATE Here is the other piece of code I was trying...It still doesnt work..I have posted the output after adding the exp_internal 1 command..The code is as follows:
spawn telnet 10.1.1.2
expect "Login:"
send "xyz\r"
expect "Password:"
send "Nxyz1\r"
expect "xyz:/home/xyz>"
send "cd /sonus/support/GSX-[lindex $argv 0]\r"
log_file myfile.log
send_log "this is in the log file \n"
log_file
interact
OUTPUT
spawn telnet 10.1.1.2
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {17179}
`expect: does "" (spawn_id exp6) match glob pattern "Login:"? no`
`Trying 10.1.1.2...`
`expect: does "Trying 10.1.1.2...\r\n" (spawn_id exp6) match glob pattern "Login:"? no`
`Connected to 10.1.1.2.`
`Escape character is '^]'.`
`expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n" (spawn_id exp6) match glob pattern "Login:"? no`
`SunOS 5.9`
`expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\r" (spawn_id exp6) match glob pattern "Login:"? no
login: xyz\r`
`expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: " (spawn_id exp6) match glob pattern "Login:"? no`
`expect: timed out`
`send: sending "xyz\r" to { exp6 }`
`expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: " (spawn_id exp6) match glob pattern "Password:"? no
xyz`
`expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: xyz\r\n" (spawn_id exp6) match glob pattern "Password:"? no`
`Password:`
`expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: xyz\r\nPassword: " (spawn_id exp6) match glob pattern "Password:"? yes`
`expect: set expect_out(0,string) "Password:"`
`expect: set expect_out(spawn_id) "exp6"`
`expect: set expect_out(buffer) "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: xyz\r\nPassword:"`
`send: sending "Nxyz1\r" to { exp6 }`
`expect: does " " (spawn_id exp6) match glob pattern "xyz:/home/xyz>"? no`
`expect: does " \r\n" (spawn_id exp6) match glob pattern "xyz:/home/xyz>"? no`
`Last login: Tue May 31 05:10:20 from 10.253.6.98
/home/xyz/.aliases: No such file or directory.`
`[1]slate:xyz:/home/xyz>`
`expect: does " \r\nLast login: Tue May 31 05:10:20 from 10.253.6.98\r\n/home/xyz/.aliases: No such file or directory.\r\n\u001b]0;[slate:]/home/xyz\u0007[1]slate:\u001b[1mxyz\u001b[m:/home/xyz> " (spawn_id exp6) `match glob pattern "xyz:/home/xyz>"? no
`expect: timed out`
`send: sending "cd /sonus/support/GSX-5\r" to { exp6 }`
`tty_raw_noecho: was raw = 0 echo = 1`
`spawn id exp6 sent <c>`
`cspawn id exp6 sent <d /sonus/support/GSX-5\r\r\n\u001b]0;[slate:]/sonus/support/GSX-5\u0007[2]slate:\u001b[1msdwarampudi\u001b[m:/sonus/support /GSX-5> >`
`/sonus/support/GSX-5`
`[2]slate:xyz:/sonus/support/GSX-5>`