Open fangxlmr opened 3 years ago
stty raw
to disable all translationsexport LC_ALL=en_US.ISO-8859-1
to avoid encoding problems with expect
@clarkwang Thanks. Indeed, the question on Stackoverflow is posted by me as well.
@douniwan5788 Yes! That does work! Thanks!
One more question:
Since I wanna keep the 'newline' symbol as whatever it is, how to avoid \r\n
translation?
This might happen when cat
a binary data. Binary data might contain byte 0a
(i.e. \n
) so that expect
converts it to 0d0a
(i.e. \r\n
) resulting in broken binary as well.
spawn "telnet xxx"
fconfigure $spawn_id -translation crlf
focnfigure
command seems solve the translation issue.
It seems like no one is maintaining this repo any more, but I still wanna post the issue here since it confuse me a lot and closely releated to
expect
command. Assuming I'd like to fetch data from remote withuser/password
auth automating inexpect
script, like the following: ps: I usesh
to refer ssh/telnet connectionAs the last command said, captured command
ls
(i.e. a.out) has broken locally. And you can find if you actually run the script, the two files are different in bytesize (let alone checksum).I though it might be related to traslation and encoding issue, so I change the
expect.sh
script to this and it still not workingAny body has any idea?