Created
August 30, 2016 12:35
-
-
Save leihog/8ea31cde841e7049ea7d49ab3e88835b to your computer and use it in GitHub Desktop.
run-local-script-remote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cmd=${0##*/} | |
ssh -t $1 "$(sed '1,/^#xxxREMOTExxx#$/d' < $0) > /tmp/$cmd.$$.sh && sh /tmp/$cmd.$$.sh; rm /tmp/$cmd.$$.sh" | |
exit $? | |
#xxxREMOTExxx# | |
#!/bin/sh | |
echo "This is executed on the remote server" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment