[wellylug] ssh scripting

Donald Gordon don at dis.org.nz
Sat May 21 16:12:53 NZST 2005


On 20/05/2005, at 8:26 PM, Jamie Baddeley wrote:
> Is it possible to script ssh commands?

#!/bin/sh
ssh hex /bin/sh <<END
df -h
END

Admittedly this doesn't work if your script wants to do something with 
standard input.  It's worth noting that it works with other languges 
too:

#!/bin/sh
ssh hex /usr/bin/perl <<END
use Some::Perlish::Stuff;
...
END

and that combining this technique and Data::Dumper can be pretty nifty.

donald




More information about the wellylug mailing list