From 42392307a49a0b0aa916ecf9a7f2e1a94734f0fd Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Mon, 8 Dec 2025 22:38:20 +0300 Subject: [PATCH] Features: 1) Improve handling of user prompts by consolidating `read` and `printf` usage; Fixes: 1) Remove unnecessary else blocks for default values in prompt functions; 2) Ensure proper initialization of `response` variable to avoid undefined behavior; Extra: 1) Use consistent `printf` formatting across `prompt_default` and `prompt_autogen` functions for cleaner output; 2) Minor indentation and code cleanup. --- scripts/Unix/generate-environment-file.sh | 28 ++++++++--------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/scripts/Unix/generate-environment-file.sh b/scripts/Unix/generate-environment-file.sh index eeac970d..fafc8dcb 100755 --- a/scripts/Unix/generate-environment-file.sh +++ b/scripts/Unix/generate-environment-file.sh @@ -8,38 +8,28 @@ get_random_hex() { } prompt_default() { + local response="" if [ -t 0 ]; then - printf "Enter %s [%s]: " "$1" "$2" - if read -r response