From 8d2539f113f56ac0995a2c0a1cd82a1c15a33729 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Tue, 3 Oct 2017 15:00:09 +0200
Subject: [PATCH] BUG: apply shellcheck to fix potential script issues

---
 Packaging/Files/linux_pkgsetup.in               | 4 ++--
 Packaging/Files/macx_pkgsetup.in                | 2 +-
 Utilities/Maintenance/SuperbuildDownloadList.sh | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Packaging/Files/linux_pkgsetup.in b/Packaging/Files/linux_pkgsetup.in
index 6db2cd11cc..93d5a6a082 100644
--- a/Packaging/Files/linux_pkgsetup.in
+++ b/Packaging/Files/linux_pkgsetup.in
@@ -44,7 +44,7 @@ PATCH_ELF_EXE="$OUT_DIR/patchelf"
 #do not move below block. it must be before "unset LD_LIBRARY_PATH" code
 #check if we have any python bindings
 if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ] ; then
-    chmod +x $OUT_DIR/setup_python.sh
+    chmod +x "$OUT_DIR/setup_python.sh"
     ./setup_python.sh || setup_python_ret=$?
 fi
 
@@ -52,7 +52,7 @@ fi
 unset LD_LIBRARY_PATH
 
 # we remove files in $OUT_DIR/lib/gtk which we CANNOT add new rpath
-BINARY_FILES=$(find $OUT_DIR/lib $OUT_DIR/bin -type f -exec file {} \; | grep -v '/lib/gtk/' | grep -i elf|cut -f1 -d':')
+BINARY_FILES=$(find "$OUT_DIR/lib" "$OUT_DIR/bin" -type f -exec file {} \; | grep -v '/lib/gtk/' | grep -i elf|cut -f1 -d':')
 # run patchelf
 for bin_file in $BINARY_FILES; do
     #echo "adding rpath to $bin_file"
diff --git a/Packaging/Files/macx_pkgsetup.in b/Packaging/Files/macx_pkgsetup.in
index 971e79eff3..7c4b5c8e94 100755
--- a/Packaging/Files/macx_pkgsetup.in
+++ b/Packaging/Files/macx_pkgsetup.in
@@ -41,7 +41,7 @@ OUT_DIR=$(pwd)
 
 #do not move below 3 lines. it must be before "unset LD_LIBRARY_PATH" code
 if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ] ; then
-  chmod +x $OUT_DIR/setup_python.sh
+  chmod +x "$OUT_DIR/setup_python.sh"
   ./setup_python.sh || setup_python_ret=$?
 fi
 
diff --git a/Utilities/Maintenance/SuperbuildDownloadList.sh b/Utilities/Maintenance/SuperbuildDownloadList.sh
index 6a658dfe43..da5c4cb21b 100755
--- a/Utilities/Maintenance/SuperbuildDownloadList.sh
+++ b/Utilities/Maintenance/SuperbuildDownloadList.sh
@@ -45,7 +45,7 @@ if [[ "$GIT_BRANCH" =~ release-* ]]; then
 else
     VERSION="develop"
 fi
-CMAKE_FILES=$(find $SB_CMAKE_DIR -maxdepth 1 -type f -name "External_*")
+CMAKE_FILES=$(find "${SB_CMAKE_DIR}" -maxdepth 1 -type f -name "External_*")
 DOWNLOAD_LIST=$(grep -h -E '^[^#]*\"(ftp|http|https)://.*(\.tar\.gz|\.tar\.bz2|\.tgz|\.tar\.xz|\.zip|export=download).*\"' ${CMAKE_FILES} |
 		    grep -o -E '(ftp|http|https)://[^\"]*' | sort | uniq)
 
-- 
GitLab