From e5f738b5677f5d09265af744577f24e72dccfebd Mon Sep 17 00:00:00 2001 From: Emik Date: Mon, 10 Feb 2025 17:29:33 +0800 Subject: [PATCH] Fix: "read -p" does not support color formatting (#2191) * Fix: "read -p" does not support color formatting * Fix: "read -p" does not support color formatting --- misc/build.func | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/build.func b/misc/build.func index e0419a2e..86f01b2f 100644 --- a/misc/build.func +++ b/misc/build.func @@ -956,7 +956,8 @@ check_container_resources() { if [[ "$current_ram" -lt "$var_ram" ]] || [[ "$current_cpu" -lt "$var_cpu" ]]; then echo -e "\n${INFO}${HOLD} ${GN}Required: ${var_cpu} CPU, ${var_ram}MB RAM ${CL}| ${RD}Current: ${current_cpu} CPU, ${current_ram}MB RAM${CL}" echo -e "${YWB}Please ensure that the ${APP} LXC is configured with at least ${var_cpu} vCPU and ${var_ram} MB RAM for the build process.${CL}\n" - read -r -p "${INFO}${HOLD} May cause data loss! ${INFO} Continue update with under-provisioned LXC? " prompt + echo -ne "${INFO}${HOLD} May cause data loss! ${INFO} Continue update with under-provisioned LXC? " + read -r prompt # Check if the input is 'yes', otherwise exit with status 1 if [[ ! ${prompt,,} =~ ^(yes)$ ]]; then echo -e "${CROSS}${HOLD} ${YWB}Exiting based on user input.${CL}" @@ -975,7 +976,8 @@ check_container_storage() { if (( usage > 80 )); then # Prompt the user for confirmation to continue echo -e "${INFO}${HOLD} ${YWB}Warning: Storage is dangerously low (${usage}%).${CL}" - read -r -p "Continue anyway? " prompt + echo -ne "Continue anyway? " + read -r prompt # Check if the input is 'y' or 'yes', otherwise exit with status 1 if [[ ! ${prompt,,} =~ ^(y|yes)$ ]]; then echo -e "${CROSS}${HOLD}${YWB}Exiting based on user input.${CL}"