Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/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