From e06c7f43e4311399c934914502e20d334af2ee27 Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Thu, 21 Mar 2024 18:35:30 +0100 Subject: [PATCH] chore: fix install script --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index b32b04c..2c5092b 100644 --- a/install.sh +++ b/install.sh @@ -18,14 +18,14 @@ function install() { function backup_file() { local file=$1 - local date=$(date +"%Y%m%d_%H%M%S") - local backup_file="${file}.${date}.bak" - echo "Backing up $file to $backup_file" - cp "$file" "$backup_file" + local stamp=$(date +"%Y%m%d_%H%M%S") + local file_bak="${file}.${stamp}.bak" + echo "Backing up $file to $file_bak" + cp "$file" "$file_bak" } function include_in_config() { - backup $HOME/printer_data/config/printer.cfg + backup_file "$HOME/printer_data/config/printer.cfg" echo "Including macro and configuration at the top of printer.cfg" ed -s $HOME/printer_data/config/printer.cfg <>$HOME/printer_data/config/moonraker.conf <