#!/bin/bash HOST=$1 ssh root@$HOST 'bash -s' <<'ENDSSH' # commands to run on remote host echo Installing httpd yum install -y httpd echo Yum exited with status $? ENDSSH #### #!/usr/bin/perl use v5.14; use Net::SSH::Perl; my ($host, $user, $pass) = @ARGV; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd('ls -ltr'); say $stdout;