From aeccba1564bf09991fba1f4e3bc4f82a70f83879 Mon Sep 17 00:00:00 2001 From: James Pannacciulli Date: Thu, 18 Nov 2021 00:26:29 -0500 Subject: fix bug affecting savecmd output --- pars.sh | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/pars.sh b/pars.sh index fa7a7ce..379372f 100644 --- a/pars.sh +++ b/pars.sh @@ -81,20 +81,6 @@ _parssh.out () { done } -_parssh.savecmd () { - CMDLINE=$(fc -ln -0) - CMDLINE="${CMDLINE#[[:space:]][[:space:]]}" - printf "### # ##\n" - printf "### %s: %s\n"\ - date "$(date +%F@%R%z)"\ - user "$USER($UID)"\ - pwd "$PWD"\ - cmdline "$CMDLINE" - printf "### BEGIN parssh remote commands ###\n" - printf "%s\n### END parssh remote commands ###\n### ## #\n"\ - "$@" -} - # fd handlers _parssh.serverlist_fd () { [[ -z "$_parssh_servers" ]] && { @@ -212,7 +198,20 @@ parssh () { # run main command loop / capture outputs { - [[ "$_parssh_savecmd" == "true" ]] && _parssh.savecmd + [[ "$_parssh_savecmd" == "true" ]] && { + CMDLINE=$(fc -ln -0) + CMDLINE="${CMDLINE#[[:space:]][[:space:]]}" + printf "### # ##\n" + printf "### %s: %s\n"\ + date "$(date +%F@%R%z)"\ + user "$USER($UID)"\ + pwd "$PWD"\ + cmdline "$CMDLINE" + printf "### BEGIN parssh remote commands ###\n" + printf "%s\n### END parssh remote commands ###\n### ## #\n"\ + "$@" + } + while read host; do while (( $(jobs -pr | wc -l) >= ${_parssh_concurrency:-4} )); do sleep 1 -- cgit v1.2.3