From 9c892810e73764e8a460b1abb7cecfe66b0717b5 Mon Sep 17 00:00:00 2001
From: remi <remi.cresson@irstea.fr>
Date: Wed, 11 Oct 2017 10:14:26 +0200
Subject: [PATCH] ENH: logging displays lists better
---
scripts/BashUtils.sh | 4 ++--
scripts/DownloadTheiaProducts.sh | 8 +++-----
scripts/ProcessTimeSeries.sh | 4 ++--
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/scripts/BashUtils.sh b/scripts/BashUtils.sh
index c8b86f2..8d210b9 100755
--- a/scripts/BashUtils.sh
+++ b/scripts/BashUtils.sh
@@ -22,8 +22,8 @@
###########################################################################
function logging {
logstr="[$(date)] : $@"
- echo $logstr
- echo $logstr >> $LOG_FILE
+ echo "$logstr"
+ echo "$logstr" >> $LOG_FILE
}
###########################################################################
diff --git a/scripts/DownloadTheiaProducts.sh b/scripts/DownloadTheiaProducts.sh
index 72df479..39d10b0 100755
--- a/scripts/DownloadTheiaProducts.sh
+++ b/scripts/DownloadTheiaProducts.sh
@@ -77,12 +77,12 @@ for TILE in "${TILES[@]}";
EXISTING_PLIST=$(cat $COMPLETE_FILE | sed 's!.*/!!' | sed "s/${NDVI_SUFFIX}.tif//")
fi
logging "Remote products:"
- logging "$PLIST"
+ logging "${PLIST[@]}"
logging "Already processed products:"
- logging "$EXISTING_PLIST"
+ logging "${EXISTING_PLIST[@]}"
logging "Products to download:"
TODO_LIST=$(echo "$PLIST" | grep -Fxv "$EXISTING_PLIST")
- logging "$TODO_LIST"
+ logging "${TODO_LIST[@]}"
if [ -z "$TODO_LIST" ];
then
@@ -145,8 +145,6 @@ for TILE in "${TILES[@]}";
cd $MAIN_SCRIPTS_DIR
find $DOWNLOAD_DIR -type f -iname "*.zip" -exec ./ProcessArchive.sh {} \;
-
-
# clean
DeleteDirectory $DOWNLOAD_DIR
done # next tile
diff --git a/scripts/ProcessTimeSeries.sh b/scripts/ProcessTimeSeries.sh
index 8e80302..c84c1f2 100755
--- a/scripts/ProcessTimeSeries.sh
+++ b/scripts/ProcessTimeSeries.sh
@@ -43,13 +43,13 @@ do
IMAGES_FILENAMES_LIST=$(cat $CURRENT_TILE_LIST_FILENAME | sort)
logging "Image list:"
- logging "$IMAGES_FILENAMES_LIST"
+ logging "${IMAGES_FILENAMES_LIST[@]}"
# Generates the dates ASCII file
# works on SENTINEL2 products
IMAGES_DATES_LIST=$(echo "$IMAGES_FILENAMES_LIST" | sed 's!.*/!!' | cut -f2 -d_ | cut -f1 -d-)
logging "Dates list:"
- logging "$IMAGES_DATES_LIST"
+ logging "${IMAGES_DATES_LIST[@]}"
# Output directory
CURRENT_TILE_OUTPUT_DIR=${CURRENT_TILE_DIR}/${OUTPUT_DIRNAME}
--
GitLab