I'm fairly new to tcl and expect. I'm using expect to ssh into another account, and dump the contents of a directory (via "ls -la").
I'm using log_file in order to get the stdout into a file on my machine.
When I open this file later on (vi) I see some strange characters, at the end of every line:
drwx------ 3 root root 4096 Apr 14 06:54 ^[[00m.bashrc^[[00m
this line displays normally this way:
drwx------ 3 root root 4096 Apr 14 06:54 .bashrc
What am I missing here?
Here is the script (very short):
#! /usr/bin/expect --
spawn ssh -l newuser 127.0.0.1
expect "]$ "
send "ls -la\r"
expect "]$ "
Pinned topic strange chars in Expect log_file
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2004-07-23T21:52:06Z at 2004-07-23T21:52:06Z by SystemAdmin
Re: strange chars in Expect log_file2004-05-13T18:27:20ZThis is the accepted answer. This is the accepted answer.
My guess is the extra characters are caused by your
terminal color coding the output, you probable have
an alias for "ls" such as "ls -F --color=auto",
unset the alias before you run the command after you
Also, you can add a line in the script "exp_internal 1" to see the
raw output of the characters as expect would
see them. This is invaluable to debugging expect scripts.
Re: strange chars in Expect log_file2004-07-23T21:52:06ZThis is the accepted answer. This is the accepted answer.thats most probably the terminal chars as already pointed out. another simpilar option would be to use a simpilar command like
ssh server command
after generating keys on th ebox where you are running your script and copying the public key to the server.