From 5db5fcb407073ca2c6e7c2dc9dd730a77e65ed8d Mon Sep 17 00:00:00 2001 From: Alex Meyer Date: Tue, 14 May 2024 16:16:36 -0400 Subject: [PATCH] make `log` output to stderr --- functions/compression.sh | 2 +- functions/logger.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/compression.sh b/functions/compression.sh index e2af3fe2..9616a2c3 100644 --- a/functions/compression.sh +++ b/functions/compression.sh @@ -34,7 +34,7 @@ find_compatible_compression_format() { local normalized_filename=$(echo "$1" | tr '[:upper:]' '[:lower:]') local system=$(echo "$1" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$") - if [[ $(validate_for_chd "$1") == *"true" ]] && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "chd" ]]; then + if [[ $(validate_for_chd "$1") == "true" ]] && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "chd" ]]; then echo "chd" elif grep -qF ".${normalized_filename##*.}" $zip_compressable_extensions && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "zip" ]]; then echo "zip" diff --git a/functions/logger.sh b/functions/logger.sh index d37dafb6..9c2ea6c3 100755 --- a/functions/logger.sh +++ b/functions/logger.sh @@ -86,11 +86,11 @@ log() { esac # Display the message in the terminal - echo -e "$colored_message" + echo -e "$colored_message" >&2 # Write the log message to the log file if [ ! -f "$logfile" ]; then - echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" + echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" >&2 touch "$logfile" fi echo "$log_message" >> "$logfile"