參考

expect要紀錄執行結果或輸出
可以用log_file這個指令

#!/usr/bin/expect -f
log_file -noappend /tmp/myfile.log
#log_file預設append or create if not exist
#若你要每次重新紀錄,要加上-noappend指令

另外
send_log也可以將送訊息到log_file指定的檔案
send_log "end of it"


log_file [args] [[-a] file]If a filename is provided, log_file will record a transcript of the session (beginning at that point) in the file. log_file will stop recording if no argument is given. Any previous log file is closed.

Instead of a filename, a Tcl file identifier may be provided by using the -open or -leaveopen flags. This is similar to the spawn command. (See spawn for more info.)

The -a flag forces output to be logged that was suppressed by the log_user command.

By default, the log_file command appends to old files rather than truncating them, for the convenience of being able to turn logging off and on multiple times in one session. To truncate files, use the -noappend flag.

The -info flag causes log_file to return a description of the most recent non-info arguments given

arrow
arrow
    全站熱搜

    slinbody 發表在 痞客邦 留言(0) 人氣()