Fix up lookup code to deal with spaces etc. in directory names
authorSteve McIntyre <steve@einval.com>
Sat, 21 Apr 2018 00:54:03 +0000 (01:54 +0100)
committerSteve McIntyre <steve@einval.com>
Sat, 21 Apr 2018 00:54:03 +0000 (01:54 +0100)
Do lookups and file copying in a subshell, to simplify the globbing

abcde
changelog

diff --git a/abcde b/abcde
index 1d2d0b6..18c3135 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -2646,12 +2646,15 @@ do_cdtext_read ()
                echo "CD-Text" > "${SOURCE_WORKDIR}/datasource.${NUM_CDDB_MATCHES}"
                echo "none ${CDDBDISCID} ${ATITLE}" >> "${SOURCE_WORKDIR}/cddbquery.${NUM_CDDB_MATCHES}"
 
                echo "CD-Text" > "${SOURCE_WORKDIR}/datasource.${NUM_CDDB_MATCHES}"
                echo "none ${CDDBDISCID} ${ATITLE}" >> "${SOURCE_WORKDIR}/cddbquery.${NUM_CDDB_MATCHES}"
 
-               ( cd "${SOURCE_WORKDIR}" && rm -f audio_* audio.* )
-               for file in ${SOURCE_WORKDIR}/cddbread.* ${SOURCE_WORKDIR}/cddbquery.* ${SOURCE_WORKDIR}/datasource.*; do
-                       if [ -f "$file" ]; then
-                               cp "$file" "${ABCDETEMPDIR}"
-                       fi
-               done
+               (
+                       cd "${SOURCE_WORKDIR}"
+                       rm -f audio_* audio.*
+                       for file in cddbread.* cddbquery.* datasource.*; do
+                               if [ -f "$file" ]; then
+                                       cp "$file" "${ABCDETEMPDIR}"
+                               fi
+                       done
+               )
                echo "cdtext-readcomplete" >> "${ABCDETEMPDIR}/status"
                echo "cdtext-entries=1" >> "${ABCDETEMPDIR}/status"
        fi
                echo "cdtext-readcomplete" >> "${ABCDETEMPDIR}/status"
                echo "cdtext-entries=1" >> "${ABCDETEMPDIR}/status"
        fi
@@ -2863,11 +2866,14 @@ do_cddb_read ()
                        echo "cddb-read-${NUM_CDDB_MATCHES}-complete" >> "${ABCDETEMPDIR}/status"
                        ;;
                esac
                        echo "cddb-read-${NUM_CDDB_MATCHES}-complete" >> "${ABCDETEMPDIR}/status"
                        ;;
                esac
-               for file in ${SOURCE_WORKDIR}/cddbread.* ${SOURCE_WORKDIR}/cddbquery.* ${SOURCE_WORKDIR}/datasource.*; do
-                       if [ -f "$file" ]; then
-                               cp "$file" "${ABCDETEMPDIR}"
-                       fi
-               done
+               (
+                       cd "${SOURCE_WORKDIR}"
+                       for file in cddbread.* cddbquery.* datasource.*; do
+                               if [ -f "$file" ]; then
+                                       cp "$file" "${ABCDETEMPDIR}"
+                               fi
+                       done
+               )
                echo "cddb-readcomplete" >> "${ABCDETEMPDIR}/status"
                echo "cddb-entries=$NUM_RESPONSES" >> "${ABCDETEMPDIR}/status"
        fi
                echo "cddb-readcomplete" >> "${ABCDETEMPDIR}/status"
                echo "cddb-entries=$NUM_RESPONSES" >> "${ABCDETEMPDIR}/status"
        fi
index d8539d1..24793a5 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,6 +1,6 @@
 abcde 2.9.2
 
 abcde 2.9.2
 
- * 
+ * Fix up lookup code to deal with spaces etc. in directory names
 
 abcde 2.9.1
 
 
 abcde 2.9.1