擅长:python、mysql、java
<p>默认情况下,JunOS对任何命令返回的冗长输出进行分页。可能发生的情况是,您所连接到的Juniper设备正在对<code>show configuration | display set</code>命令的输出进行分页,而Exscript正在超时,因为该设备正在等待用户输入以继续对命令的输出进行分页,而不是返回Exscript识别的提示。在</p>
<p>我将作如下修改:</p>
<pre><code>for ii in JUNIPER:
print ii
cmd2 = 'show configuration | display set | no-more'
conn.connect(ii)
conn.login(account1)
conn.execute(cmd2)
print conn.response
</code></pre>
<p>这将禁用该命令的输出分页,并应立即返回到提示并允许Exscript将输出返回给您。此外,我还为我的命令添加了回车键,即:</p>
^{pr2}$
<p>但是做上述操作的有用性是值得商榷的,好像我正确地记得<code>execute()</code>方法应该为您这样做。在</p>