summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/gather-files12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/gather-files b/scripts/gather-files
index edf7a8a..0798a41 100755
--- a/scripts/gather-files
+++ b/scripts/gather-files
@@ -1,6 +1,6 @@
#!/bin/bash
-if [ $# -ne 1 ]; then
+if [ $# -gt 1 ]; then
>&2 echo 'usage: '"$0"' host'
exit 1
fi
@@ -37,9 +37,13 @@ cmd=$(
)
{
- ssh "${1}" -t "sudo -s bash -c '${cmd}'" \
- || ssh "${1}" -t "su -c '${cmd}'" \
- | sed 1d
+ if [ $# -eq 1 ]; then
+ ssh "${1}" -t "sudo -s bash -c '${cmd}'" \
+ || ssh "${1}" -t "su -c '${cmd}'" \
+ | sed 1d
+ else
+ bash -c "${cmd}"
+ fi
} \
2>/dev/null \
| tee /dev/stderr \