From 5155fbb5b9eef8796b463571aa40565db568bbf4 Mon Sep 17 00:00:00 2001 From: Snoby Date: Mon, 15 Apr 2024 22:10:24 +0000 Subject: [PATCH 1/2] Allow for executing executible commands set from the command line. For example $(nproc) --- h-config.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/h-config.sh b/h-config.sh index c067fc7..2e3b96c 100755 --- a/h-config.sh +++ b/h-config.sh @@ -29,6 +29,11 @@ process_user_config() { # Check if modifications were made, if not, use original parameter [[ "$param" != "$modified_param" ]] && param=$modified_param + # Execute shell commands if present in the value + if [[ "$value" =~ \$\(.+\) ]]; then + # Evaluate the command within the value + value=$(eval echo "$value") + fi # Check if value exists before updating Settings if [[ ! -z "$value" ]]; then if [[ "$param" == "overwrites" ]]; then From 0358dc6e18669356afb5539340ccb9ba3bcb1d97 Mon Sep 17 00:00:00 2001 From: Snoby Date: Mon, 15 Apr 2024 22:31:26 +0000 Subject: [PATCH 2/2] Allow math in nested command --- h-config.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/h-config.sh b/h-config.sh index 2e3b96c..c0e1661 100755 --- a/h-config.sh +++ b/h-config.sh @@ -29,9 +29,7 @@ process_user_config() { # Check if modifications were made, if not, use original parameter [[ "$param" != "$modified_param" ]] && param=$modified_param - # Execute shell commands if present in the value - if [[ "$value" =~ \$\(.+\) ]]; then - # Evaluate the command within the value + if [[ "$value" =~ \$\(.*\) ]]; then value=$(eval echo "$value") fi # Check if value exists before updating Settings