There is a problem on executing awk command to remote servers;
The shell test script is like this :
- #!/bin/sh
- _CMD="ssh root@localhost"
- cpu_num="$($_CMD awk '/processor/{count["proc"]++}; END{print count["proc"]}' /proc/cpuinfo)“
- echo $cpu_num
My root account can entry the server without the passwd.
But I found no result on the screen .
Is there some error on that script ? By the way , I googled and found use the following method can run the right result .
- #!/bin/sh
- _CMD="ssh root@localhost"
- cpu_num="$($_CMD << 'HERE'
- awk '/processor/{count["proc"]++}; END{print count["proc"]}' /proc/cpuinfo
- HERE
- )“
- echo $cpu_num
_______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos