aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pars.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/pars.sh b/pars.sh
index 819153b..f6741b7 100644
--- a/pars.sh
+++ b/pars.sh
@@ -8,7 +8,6 @@ parssh () {
[0-9]*)
[[ "${1#-}" != *[^0-9]* ]] && {
local parssh_concurrency=${1#-}
- shift
}
;;
fo|fouter)
@@ -18,7 +17,6 @@ parssh () {
}
local parssh_fouter="$2"
shift
- shift
;;
fi|finner)
[[ -r "$2" ]] || {
@@ -27,9 +25,12 @@ parssh () {
}
local parssh_finner="$2"
shift
- shift
+ ;;
+ p|prepend_host)
+ local parssh_prepend_host=true
;;
esac
+ shift
done
[[ -z "$parssh_fouter" ]] && {
@@ -43,12 +44,17 @@ parssh () {
sleep 1
done
if [[ -z "$parssh_finner" ]]; then
- ssh -no StrictHostKeyChecking=no $host "$@" &
+ ssh -no StrictHostKeyChecking=no $host "$@" | host_prepend &
else
- ssh -To StrictHostKeyChecking=no $host "$@" < "$parssh_finner" &
+ ssh -To StrictHostKeyChecking=no $host "$@" < "$parssh_finner" | host_prepend &
fi
done <&9
wait
exec 9>&-
[[ "${origopts//[^m]/}" == "m" ]] || set +m
}
+
+host_prepend ()
+ while read -r; do
+ printf "${parssh_prepend_host+$host: }%s\n" "$REPLY"
+ done