Skip to content

Instantly share code, notes, and snippets.

@gleero
Created November 13, 2013 21:10
Show Gist options
  • Select an option

  • Save gleero/7456463 to your computer and use it in GitHub Desktop.

Select an option

Save gleero/7456463 to your computer and use it in GitHub Desktop.
#!/bin/bash
if echo "$1" | grep ":" > /dev/null; then
srv="`echo \"$1\" | awk -F\: '{ print \$1}'`"
pth="`echo \"$1\" | awk -F\: '{ print \$2}'`"
cmd="cd $pth;"
else
srv="$1"
fi
cmd="$cmd cat | bash"
cat $2 | ssh "$srv" "$cmd"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment