How can I run commands in batch mode over ssh? That is, what is the ssh command's equivalent of sftp -b <filename> <hostname>?I have a set of commands which I wish to run across a set of hosts connecting over ssh. Over sftp, i store the commands in a file filename and connect to the host and run the commands using the previously mentioned command.Is something like that possible over ssh?
How to run commands in batch mode over ssh?
ssh;scripting;solaris
Correct me if I'm wrong, but you seem to be wanting to run regular shell commands on the remote server where the script is local.#!/bin/shtrap rm -f /tmp/sendonssh.$$.* 0 1 2 3 15# commands to run on the remote servercat <<'EOF' >> /tmp/sendonssh.$$.shmkdir -p /tmp/foobar.$$mv $HOME/xyzzy /tmp/foobar.$$chmod 640 $HOME/xyzzyEOF# call for each argumentfor userhost in $@; do    errorout=`ssh -aTxo BatchMode=yes $userhost /bin/sh -s < /tmp/sendonssh.$$.sh 2>&1`    rc=$?    if [ $rc -ne 0 ]; then        echo Error: $userhost: $errorout        exit $rc    fidoneI do this with some 'remote execution' apps in my test environment using Python instead of the shell: ssh $userhost python < $pythonscriptfilename.