Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Overbryd
Created September 30, 2013 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Overbryd/6760582 to your computer and use it in GitHub Desktop.
Save Overbryd/6760582 to your computer and use it in GitHub Desktop.
A simple script that you can use in your shebang to remote execute local scripts.
#!/bin/bash
# Usage:
# Put this thing as a shebang into your scripts
# i.e.:
#
# #!/bin/ssh_bash user@your-server.com
#
# echo "hello world from ${hostname}"
#
login=$1
script=$2
args=${@#$1}
args=${args#$2}
tar cz $script | ssh $login "tar xz && bash --login $script $args"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment