Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | ||
3 | set -e | |
4 | ||
5 | if [ $# -lt 2 ]; then | |
6 | echo "usage: rsc HOST COMMAND ARGS..." >&2 | |
7 | exit 1 | |
8 | fi | |
9 | ||
10 | host="$1"; shift | |
11 | cmd="$1"; shift | |
12 | ||
13 | ( | |
14 | echo -n "$cmd"; echo -ne '\0' | |
15 | for arg in "$@"; do | |
16 | echo -n "$arg"; echo -ne '\0' | |
17 | done | |
18 | ) | exec ssh "$host" "xargs -0x sh -c 'exec \$0 \"\$@\"'" |