Hi , all :<br><br><br>There is a problem on executing awk command to remote servers;<br><br>The shell test script is like this :<br><br><br><div id="code0"><ol><li>#!/bin/sh<br>
</li><li><br>
</li><li>_CMD="ssh root@localhost"<br>
</li><li><br>
</li><li>cpu_num="$($_CMD <span href="http://bbs.chinaunix.net/tag.php?name=awk" class="t_tag">awk</span> '/processor/{count["proc"]++}; END{print count["proc"]}' /proc/cpuinfo)“<br>
</li><li><br>
</li><li>echo $cpu_num</li></ol><br>My root account can entry the server without the passwd.<br><br>But I found no result on the screen . <br><br>Is there some error on that script ? By the way , I googled and found use the following method can run the right result .<br>
<br><div id="code1"><ol><li>#!/bin/sh<br>
</li><li><br>
</li><li>_CMD="ssh root@localhost"<br>
</li><li><br>
</li><li>cpu_num="$($_CMD << 'HERE'<br>
</li><li>awk '/processor/{count["proc"]++}; END{print count["proc"]}' /proc/cpuinfo<br>
</li><li>HERE<br>
</li><li><br>
</li><li>)“<br>
</li><li><br>
</li><li>echo $cpu_num</li></ol><br><br><br></div><br></div><br><br><br><br>