From 591502250a63621b729740a056369a819b6d49d9 Mon Sep 17 00:00:00 2001 From: James Pannacciulli Date: Sun, 12 Apr 2015 21:31:31 -0700 Subject: distinguish funcs from vars by using '.' in names --- pars.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pars.sh b/pars.sh index 93b8ca6..7af98b8 100644 --- a/pars.sh +++ b/pars.sh @@ -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."\ ""\ -- cgit v1.2.3