I am trying to execute the following command using perl script :
my $sum = `$sudo $ssh $server netstat -Aan | /bin/grep 1158 | /bin/egrep '@IP[0]' | wc -l`;
Where $sudo = full path to sudo command , same for $ssh , $server = the file server that I want to pull the data from , and @Ip[0] = ip address.
When I run the exact command from the shell (not as a script) I get the required result (which is an integer number). However , when I run the script it just gets hangs when it reaches to that point.
I cant see anything wrong with the syntax , I am using back ticks to save the returned output , could you please assist?