Skip to content

Instantly share code, notes, and snippets.

@breezhang
Created October 17, 2015 13:31
Show Gist options
  • Save breezhang/45c92dcc68647d8c129b to your computer and use it in GitHub Desktop.
Save breezhang/45c92dcc68647d8c129b to your computer and use it in GitHub Desktop.
like perl ruby <<
How about a "here document"
ssh otherhost << EOF
ls some_folder;
./someaction.sh 'some params'
pwd
./some_other_action 'other params'
EOF
To avoid the problems mentioned by @Globalz in the comments, you may be able to (depending what you're doing on the remote site) get away with replacing the first line with
ssh otherhost /bin/bash << EOF
http://tldp.org/LDP/abs/html/here-docs.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment