From 2fde22116c7f85841f8b66b3db5e0adc873927f6 Mon Sep 17 00:00:00 2001 From: gmega Date: Wed, 25 Jun 2025 20:01:33 -0300 Subject: [PATCH] fix: fix shellcheck errors, minor improvements --- experiments/k-node.sh | 11 +++++++++-- src/clh | 5 ++++- src/procmon.bash | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/experiments/k-node.sh b/experiments/k-node.sh index ab40114..08087a5 100755 --- a/experiments/k-node.sh +++ b/experiments/k-node.sh @@ -11,13 +11,20 @@ set -e -o pipefail SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) + +# shellcheck source=./src/clh source "${SCRIPT_DIR}/../src/clh" node_count="${1:-2}" repetitions="${2:-1}" output_log="${3:-"${OUTPUTS}/k-node-$(date +%s)-${RANDOM}.csv"}" -shift 3 -file_sizes=("$@") +if [ "$#" -gt 3 ]; then + shift 3 + file_sizes=("$@") +else + echoerr "No file sizes specified, using default (100)." + file_sizes=("100") +fi exp_start "k-node" diff --git a/src/clh b/src/clh index 197041e..94a7283 100644 --- a/src/clh +++ b/src/clh @@ -14,4 +14,7 @@ source "${LIB_SRC}/experiment.bash" exp_set_outputs "${OUTPUTS}" prom_set_outputs "${PROM_TARGETS_DIR}" -exp_start "default" \ No newline at end of file +# If running from an interactive shell, fire the default experiment. +if [[ $- =~ i ]]; then + exp_start "default" +fi diff --git a/src/procmon.bash b/src/procmon.bash index 941d38b..a344632 100644 --- a/src/procmon.bash +++ b/src/procmon.bash @@ -259,7 +259,7 @@ await_all() { _pm_job_started() { local pid=$1 proc_type=$2 shift 2 - echoerr "[procmon] job started: $pid ($proc_type), args: $*" + echoerr "[procmon] job started: $pid ($proc_type), args: ${*:-}" if [ ! -f "${_pm_output}/${pid}.pid" ]; then touch "${_pm_output}/${pid}.pid" fi