I'm using a expect script to connect to a mp3 server (irmp3d) via telnet and output a playlist. When i run the script from a bash shell the script works as expected and gets the playlist. But when i run the script from within the server all i get out of the script is the commands passed to the spawned telnet client. Does anyone have any idea on how to pipe the output from the telnet client to a file?
This is my script:
Quote:
#!/usr/bin/expect
log_file -a /home/mp3/telnet.log
set host [lindex $argv 0]
set port [lindex $argv 1]
spawn telnet $host $port
send "query plfiles\r"
send "exit\r"
|
When run through a regular bash shell the log looks something like this:
Quote:
220: plfiles: /music/Black Sabbath/Headless Cross/07-Black Moon.mp3
220: plfiles: /music/Black Sabbath/Headless Cross/08-Nightwing.mp3
|
But when i run the script through the mp3 server software all i get in the log is:
Quote:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
query plfiles
|
I have tried running the command:
Quote:
script 2%>1 /home/mp3/newlog.log
|
with the same results. Does anyone have any idea on how i can solve this? If so please let me know.
Thanks!
/Peter