Browse Source

Fix quoting

Samuel W. Flint 4 years ago
parent
commit
983fdbae7b
1 changed files with 32 additions and 32 deletions
  1. 32 32
      library.org

+ 32 - 32
library.org

@@ -68,7 +68,7 @@ As a person who has a lot of books, I like to be able to keep track of them.  I'
   COMMAND=$1
   shift
 
-  case ${COMMAND} in
+  case "${COMMAND}" in
       help)
           display_help
           exit
@@ -184,10 +184,10 @@ The initialization of the database is accomplished by creating the containing di
 #+BEGIN_SRC sh
   function initialize {
       OLD=`pwd`
-      mkdir -p ${LIBRARY_DIRECTORY}
-      cd ${LIBRARY_DIRECTORY}
-      [[ ! -e `basename ${LIBRARY_FILE}` ]] && \
-          cat <<EOF > `basename ${LIBRARY_FILE}`
+      mkdir -p "${LIBRARY_DIRECTORY}"
+      cd "${LIBRARY_DIRECTORY}"
+      [[ ! -e `basename "${LIBRARY_FILE}"` ]] && \
+          cat <<EOF > `basename "${LIBRARY_FILE}"`
   <<file-format>>
   EOF
   }
@@ -213,13 +213,13 @@ This handles git as needed, by first checking to see if the first argument is ~i
       FIRST=$1
       if [[ $FIRST == "init" ]] ; then
           OLD=`pwd`
-          cd ${LIBRARY_DIRECTORY}
-          git $@
+          cd "${LIBRARY_DIRECTORY}"
+          git "$@"
           cd ${OLD}
       else
           if [[ $GIT == "detect" ]] ; then
               OLD=`pwd`
-              cd ${LIBRARY_DIRECTORY}
+              cd "${LIBRARY_DIRECTORY}"
               git "$@"
               cd ${OLD}
           fi
@@ -237,7 +237,7 @@ This handles git as needed, by first checking to see if the first argument is ~i
 #+Name: handle-query
 #+BEGIN_SRC sh
   function run_query {
-      recsel -t Book "$@" ${LIBRARY_FILE}
+      recsel -t Book "$@" "${LIBRARY_FILE}"
   }
 #+END_SRC
 
@@ -291,8 +291,8 @@ This handles git as needed, by first checking to see if the first argument is ~i
              -f ISBN -v "${ISBN}" \
              -f Location -v "${LOCATION}" \
              -f Card -v UNPRINTED \
-             ${LIBRARY_FILE}
-      do_git add `basename ${LIBRARY_FILE}`
+             "${LIBRARY_FILE}"
+      do_git add `basename "${LIBRARY_FILE}"`
       do_git commit -m "Added record for \"${TITLE}\""
   }
 #+END_SRC
@@ -311,14 +311,14 @@ This handles git as needed, by first checking to see if the first argument is ~i
           echo "library bulk-add number"
           exit 1
       fi
-      GITOLD=${GIT}
+      GITOLD="${GIT}"
       GIT=FALSE
       for i in {1..$1} ; do
           echo "Adding book number ${i}"
           add_single
       done
-      GIT=${GITOLD}
-      do_git add `basename ${LIBRARY_FILE}`
+      GIT="${GITOLD}"
+      do_git add `basename "${LIBRARY_FILE}"`
       do_git commit -m "Added ${1} records"
   }
 #+END_SRC
@@ -339,11 +339,11 @@ This handles git as needed, by first checking to see if the first argument is ~i
       fi
       NAME=$1
       shift
-      case ${NAME} in
+      case "${NAME}" in
           list)
               for report in ${LIBRARY_DIRECTORY}/reports/*.report ;
               do
-                  echo " - $(basename -- ${report} .report)"
+                  echo " - $(basename -- "${report}" .report)"
               done
           ;;
           new)
@@ -353,12 +353,12 @@ This handles git as needed, by first checking to see if the first argument is ~i
               fi
               REPORT=$1
               shift
-              echo "# -*- mode: shell-script -*-" > ${LIBRARY_DIRECTORY}/reports/${REPORT}.report
-              emacsclient --alternate-editor="" -n ${LIBRARY_DIRECTORY}/reports/${REPORT}.report
+              echo "# -*- mode: shell-script -*-" > "${LIBRARY_DIRECTORY}/reports/${REPORT}.report"
+              emacsclient --alternate-editor="" -n "${LIBRARY_DIRECTORY}/reports/${REPORT}.report"
           ;;
           ,*)
-              if [[ -e ${LIBRARY_DIRECTORY}/reports/${NAME}.report ]] ; then
-                 sh ${LIBRARY_DIRECTORY}/reports/${NAME}.report $@
+              if [[ -e "${LIBRARY_DIRECTORY}/reports/${NAME}.report" ]] ; then
+                 sh "${LIBRARY_DIRECTORY}/reports/${NAME}.report" "$@"
               fi
       esac
   }
@@ -386,18 +386,18 @@ This handles git as needed, by first checking to see if the first argument is ~i
       if [[ $FIELD = "Withdrawn" ]] ; then
           TMPDIR=. recset -e "ID = ${ID}" \
                  -f "Withdrawn" -S "`date +"%a, %d %b %Y %H:%M:%S %z"`" \
-                 ${LIBRARY_FILE}
+                 "${LIBRARY_FILE}"
           TMPDIR=. recset -e "ID = ${ID}" \
                 -f "Location" -S "WITHDRAWN" \
-                ${LIBRARY_FILE}
+                "${LIBRARY_FILE}"
       else
           VALUE=$1
           shift
           TMPDIR=. recset -e "ID = ${ID}" \
                  -f "${FIELD}" -s "${VALUE}" \
-                 ${LIBRARY_FILE}
+                 "${LIBRARY_FILE}"
       fi
-      do_git add `basename ${LIBRARY_FILE}`
+      do_git add `basename "${LIBRARY_FILE}"`
       do_git commit -m "Edited record id ${ID}"
   }
 
@@ -414,8 +414,8 @@ This handles git as needed, by first checking to see if the first argument is ~i
       shift
       TMPDIR=. recset -e "${MATCHEXPRESSION}" \
              -f "${FIELDNAME}" -S "${VALUE}" \
-             ${LIBRARY_FILE}
-      do_git add $(basename ${LIBRARY_FILE})
+             "${LIBRARY_FILE}"
+      do_git add $(basename "${LIBRARY_FILE}")
       if [[ $1 != "" ]] ; then
           do_git commit -m "${1}"
       else
@@ -446,11 +446,11 @@ This handles git as needed, by first checking to see if the first argument is ~i
 
       TMPDIR=. recset -e "ID = ${ID}" \
              -f "LoanTo" -S "${NAME}" \
-             ${LIBRARY_FILE}
+             "${LIBRARY_FILE}"
       TMPDIR=. recset -e "ID = ${ID}" \
              -f "LoanOn" -S "`date +"%a, %d %b %Y %H:%M:%S %z"`" \
-             ${LIBRARY_FILE}
-      do_git add `basename ${LIBRARY_FILE}`
+             "${LIBRARY_FILE}"
+      do_git add `basename "${LIBRARY_FILE}"`
       do_git commit -m "Loaned Book ${ID} to ${NAME}"
   }
 
@@ -465,12 +465,12 @@ This handles git as needed, by first checking to see if the first argument is ~i
 
       TMPDIR=. recset -e "ID = ${ID}" \
              -f "LoanTo" -d \
-             ${LIBRARY_FILE}
+             "${LIBRARY_FILE}"
       TMPDIR=. recset -e "ID = ${ID}" \
              -f "LoanOn" -d \
-             ${LIBRARY_FILE}
+             "${LIBRARY_FILE}"
 
-      do_git add `basename ${LIBRARY_FILE}`
+      do_git add `basename "${LIBRARY_FILE}"`
       do_git commit -m "Returned Book ${ID}"
   }
 #+END_SRC