I'm running a Perl script in which I use the command system to execute a SSH connection.
It looks like this :
$test_result = '/home/ergaconfigs/sauvegarde-configs/configs/test';
sub ssh_connect {
        my $test = system (`ssh -i /home/ergaconfigs/sauvegarde-configs/rsa_keys/key_config_saver -o "StrictHostKeyChecking no" ergaconfigs\@10.252.0.27 "show configuration | display set" > $test_result `);
        print "resultat de la commande : $test \n le code d erreur est $!";
}
But I want to make sure that the SSH connection succeeded. This is why I'm looking at the return code of system.
As the SSH connection succeed and the file is correctly written, the output is:
resultat de la commande : 65280
le code d erreur est 
And whatever the result of the ssh connection is (network unreachable etc..) I have the same output. Can somebody explain me why?
 
     
     
    