aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Pannacciulli <jpnc@jpnc.info>2021-11-18 00:26:29 -0500
committerJames Pannacciulli <jpnc@jpnc.info>2021-11-18 00:26:29 -0500
commitaeccba1564bf09991fba1f4e3bc4f82a70f83879 (patch)
tree0926313508f27f55a7bad6169cdeff8ff5a66cb7
parent040e164a3dab6ebcb532226e67e03d9402f22d65 (diff)
downloadparssh-aeccba1564bf09991fba1f4e3bc4f82a70f83879.tar.gz
parssh-aeccba1564bf09991fba1f4e3bc4f82a70f83879.tar.bz2
fix bug affecting savecmd output
-rw-r--r--pars.sh29
1 files 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