diff options
-rw-r--r-- | pars.sh | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -2,16 +2,16 @@ parssh () { (( $# )) || { - _parssh_usage + _parssh.usage return $? } local _parssh_origopts=$- set -m - local _parssh_outfun=_parssh_out + local _parssh_outfun=_parssh.out local _parssh_prepend_host=true - local _parssh_ssh=_parssh_ssh + local _parssh_ssh=_parssh.ssh while [[ "$1" == -* ]]; do case ${1#-} in @@ -34,7 +34,7 @@ parssh () { return 98 } local _parssh_rinput="$2" - local _parssh_ssh=_parssh_ssh_rinput + local _parssh_ssh=_parssh.ssh_rinput shift ;; b|-bare) @@ -46,7 +46,7 @@ parssh () { return 97 } local _parssh_outprefix="$2" - local _parssh_outfun=_parssh_out_redirect + local _parssh_outfun=_parssh.out_redirect shift ;; t|-tee) @@ -55,11 +55,11 @@ parssh () { return 96 } local _parssh_outprefix="$2" - local _parssh_outfun=_parssh_out_copy + local _parssh_outfun=_parssh.out_copy shift ;; h|-help) - _parssh_usage + _parssh.usage return $? ;; esac @@ -76,8 +76,8 @@ parssh () { while (( $(jobs -pr | wc -l) >= ${_parssh_concurrency:-4} )); do sleep 1 done - $_parssh_ssh "$@" 2> >(_parssh_host_prepend >&2) |\ - _parssh_host_prepend & + $_parssh_ssh "$@" 2> >(_parssh.host_prepend >&2) |\ + _parssh.host_prepend & done <&9 2> >($_parssh_outfun err >&2) |\ $_parssh_outfun out @@ -87,34 +87,34 @@ parssh () { [[ "${_parssh_origopts//[^m]/}" == "m" ]] || set +m } -_parssh_ssh () { +_parssh.ssh () { ssh -no StrictHostKeyChecking=no $host "$@" } -_parssh_ssh_rinput () { +_parssh.ssh_rinput () { ssh -To StrictHostKeyChecking=no $host "$@" < "$_parssh_rinput" } -_parssh_host_prepend () +_parssh.host_prepend () while read -r; do printf "${_parssh_prepend_host+$host: }%s\n" "$REPLY" done -_parssh_out () { +_parssh.out () { cat - } -_parssh_out_redirect () { +_parssh.out_redirect () { local _parssh_out_stream="$1" cat - > "${_parssh_outprefix}.${_parssh_out_stream}" } -_parssh_out_copy () { +_parssh.out_copy () { local _parssh_out_stream="$1" tee "${_parssh_outprefix}.${_parssh_out_stream}" } -_parssh_usage () { +_parssh.usage () { printf ' %s\n'\ "parssh: Parallel SSH orchestration in a Bash session."\ ""\ |