问题
Inside my "expect" script:
set $REPOS "/path/to/repo/"
set $REV 73
set LOG [spawn svnlook log -r $REV $REPOS]
What this will store in the variable "LOG": 16345 (memory location).
What it should store in the variable "LOG": "some message of the svn commit log".
It seems like the is a problem with executing a bash command and then storing that output into an expect variable.
Have you got any ideas? I am new to expect and tcl.
回答1:
You did't need spawn there. Try:
set LOG [exec svnlook log -r $REV $REPOS]
If you really want to use spawn:
spawn vnlook log -r $REV $REPOS
expect
set LOG $expect_out(buffer)
来源:https://stackoverflow.com/questions/45036988/expect-store-output-of-a-spawn-command-into-variable