`/bin/sh /tmp/rockpingping.sh $nodeName > /tmp/result.txt`; #### $flag = system("sudo /bin/sh /tmp/sshping.sh > /tmp/result.txt" ); ## '>' is the redirect operator and test.sh is the shell script If ($flag == 0 ) { // The success result will be stored at result.txt // need to open this file and then use it } else { // failure case }