]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change checksum regex one line command
authorBastian Dehn <hhaalo@arcor.de>
Wed, 30 Sep 2026 07:54:20 +0000 (09:54 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 30 Sep 2026 07:54:20 +0000 (09:54 +0200)
src/albentohandy

index 4acc835288fbaa05d171f3bb5a589c1a15b1cb48..e08c442aa7a1afff1b81df9b9ad51b9707560097 100755 (executable)
@@ -119,14 +119,15 @@ cleanup_flac()
 
 calc_checksum()
 {
+       local regex=
        [ -n "$EXTENSIONS" ] \
                || [ "${#EXTENSIONS[@]}" -ne 0 ] \
                || EXTENSIONS=("ogg" "mp3" "opus" "flac")
 
-       regex=".*\("
-       regex+=$(printf "\|\.%s" "${EXTENSIONS[@]}")
-       regex=${regex/\\\|/}
-       regex+="\)"
+       regex=$(printf "\|\.%s" "${EXTENSIONS[@]}" \
+               | sed 's/\\|//' \
+               | sed 's/^/.*\\(/' \
+               | sed 's/$/\\)/')
 
        cd "$OUTPUT_PATH" || return $?
        find . -type f -regex "$regex" -print0 \