From f29fad407841bbcc5a3e7b43c1593271fa324bd1 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Fri, 9 Oct 2026 10:06:23 -0700 Subject: [PATCH] loop, make the function much more robust. --- tasks/general/acct_mgmt/users.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index 390294d..4ec1882 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -1139,9 +1139,18 @@ } function_loop: | function loop() { - cmd="$1" + cmd="$@" + sleep="" + sleep_time=5 + if [[ "$cmd" != *"sleep"* ]]; then + sleep='echo -e "`date` - Sleeping for $sleep_time... \n"; sleep $sleep_time' + fi + count=0 while true; do - $cmd + (( count++ )) + echo "`date` - Loop $count" + eval $cmd + eval $sleep done; } alias try="loop "