Commit | Line | Data |
---|---|---|
58f76900 | 1 | #!/bin/bash |
df499390 | 2 | |
58f76900 | 3 | set -e |
535cc97f | 4 | |
58f76900 FT |
5 | if [ $# -lt 2 ]; then |
6 | echo "usage: rsc HOST COMMAND ARGS..." >&2 | |
7 | exit 1 | |
8 | fi | |
df499390 | 9 | |
58f76900 FT |
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 \"\$@\"'" |