puterboy has asked for the wisdom of the Perl Monks concerning the following question:
As part of a larger Perl program, I need to execute a local bash script on a remote machine.
I would like to do the equivalent of:
but from within a perl script using either backticks or system to run the ssh command. Something like#!/bin/bash ssh <remotehost> bash -s <<EOF <local bash script written here> EOF
Note that I want to load the bash script from within the same perl file where the ssh command is run -- not load it from an external separate file. Note that I can't run Net::SSH since I don't have access to additional modules#!/usr/bin/perl my $output = `ssh <remotehost> bash -s` <<EOF <local bash script written here> EOF
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pass local bash script to remote host via SSH (updated)
by soonix (Canon) on Jun 24, 2020 at 06:20 UTC | |
by haukex (Archbishop) on Jun 24, 2020 at 09:43 UTC | |
by soonix (Canon) on Jun 24, 2020 at 10:06 UTC | |
Re: Pass local bash script to remote host via SSH
by haukex (Archbishop) on Jun 24, 2020 at 09:55 UTC | |
by salva (Canon) on Jun 25, 2020 at 06:59 UTC | |
Re: Pass local bash script to remote host via SSH
by perlfan (Vicar) on Jun 24, 2020 at 11:48 UTC |
Back to
Seekers of Perl Wisdom