# get size of java process handles PName=$1 #echo $PName if [ "$PName" != "" ];then a=`ps aux | grep $PName | grep -v grep | grep -v zabbix |awk '{print $2}'` #echo $a arr=($a) handles=0 count=0 for PID in ${arr[@]} do handle=`sshpass -p admin12345 ssh -p 2343 -o StrictHostKeyChecking=no root@127.0.0.1 "ls -l /proc/$PID/fd | wc -l"` handles=$(($handles+$handle)) done echo ${handle} fi