在产生ssh之后或之前指定match_max时会有什么不同?

时间:2013-04-08 08:55:43

标签: linux buffer expect

# match_max 1000000000
  set timeout 60
  spawn ssh -o "StrictHostKeyChecking no" "$username@$hostname"
  match_max 1000000000

如果在使用ssh之前给出match_max选项,我不会将完整的输出输入expect_out(buffer),但如果我在SSH之后给出相同的结果,我会得到正确的结果。

另外,如果我在第一种情况下使用-d选项,我会得到完整的输出。为什么呢?

另外,我如何检查为Linux系统设置的缓冲区数量?我找了limit命令但找不到它。

1 个答案:

答案 0 :(得分:1)

期望有关match_max命令的手册页读取

match_max [-d] [-i spawn_id] [size]
defines the size of the buffer (in bytes) used internally by expect. With no size argument, the current size is returned. With the -d flag, the default size is set. (The initial default is 2000.) With the -i flag, the size is set for the named spawn id, otherwise it is set for the current process.

这正是您所观察到的(因为未指定-i)。