From 284fbf8afb0ff784507e7b0f8b9d325e8644f67c Mon Sep 17 00:00:00 2001 From: Tomáš Levora Date: Tue, 23 Apr 2019 14:28:47 +0200 Subject: Fix download scripts to handle empty lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing download and saving scripts to be able to ignore empty or 00D ending lines in lists Issue-ID: OOM-1818 Change-Id: I55ef1dfbea628f8c1d4b19745536e629a2dbe0c9 Signed-off-by: Tomáš Levora --- build/creating_data/download-files.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'build/creating_data/download-files.sh') diff --git a/build/creating_data/download-files.sh b/build/creating_data/download-files.sh index 89e2026c..f687fda1 100755 --- a/build/creating_data/download-files.sh +++ b/build/creating_data/download-files.sh @@ -16,7 +16,11 @@ # # COPYRIGHT NOTICE ENDS HERE -LIST_FILE="$1" + +# Load common-functions library +. $(dirname ${0})/../common-functions.sh + +LIST_FILE="${1}" if [[ -z "$LIST_FILE" ]]; then echo "Missing list file" exit 1 @@ -28,13 +32,13 @@ if [[ -z "$outdir" ]]; then exit 1 fi -lines=$(cat "$LIST_FILE" | wc -l) +lines=$(clean_list "$LIST_FILE" | wc -l) cnt=1 # create output dir if not exists mkdir -p "$outdir" -while read -r line; do +for line in $(clean_list "$LIST_FILE"); do # www.springframework.org/schema/tool/spring-tool-4.3.xsd file="${line%%\?*}" filename=$(basename "$file") @@ -43,5 +47,4 @@ while read -r line; do # drop below 10b/10s curl --retry 5 -y 10 -Y 10 --location "$line" -o "$outdir/$filename" &>/dev/null cnt=$((cnt+1)) - -done < "$LIST_FILE" +done \ No newline at end of file -- cgit 1.2.3-korg