From 006f4757598b17862b6158b2c0f9c38bcd9cc724 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Mon, 17 Oct 2022 17:02:36 +0200 Subject: [PATCH] refactor(gcode_shell_command): apply necessary changes for moonraker PR 491 Signed-off-by: Dominik Willner --- scripts/gcode_shell_command.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/gcode_shell_command.sh b/scripts/gcode_shell_command.sh index 5402659..3ddb3f3 100644 --- a/scripts/gcode_shell_command.sh +++ b/scripts/gcode_shell_command.sh @@ -105,11 +105,11 @@ function create_example_shell_command() { ### create a backup of the config folder backup_klipper_config_dir - local printer_cfgs path - # TODO: fix cfg path - printer_cfgs=$(find "$(get_klipper_cfg_dir)" -type f -name "printer.cfg" | sort) + local configs regex path + regex="\/home\/${USER}\/([A-Za-z0-9_]+)\/config\/printer\.cfg" + configs=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - for cfg in ${printer_cfgs}; do + for cfg in ${configs}; do path=$(echo "${cfg}" | rev | cut -d"/" -f2- | rev) if [[ ! -f "${path}/shell_command.cfg" ]]; then