Skip to content

Commit

Permalink
runs the script in a better way
Browse files Browse the repository at this point in the history
  • Loading branch information
joergi committed Oct 13, 2023
1 parent 11e9610 commit d8cfbc5
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions linux_mac/magpi-issue-downloader-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@ echo "Latest Issues is " "$latest_issues"

file="$BASEDIR/sources-for-download/regular-issues.txt";

# shellcheck disable=SC2046
bash $(dirname "$0")/magpi-issue-downloader.sh -f "$latest_issues" -l "$latest_issues"

# check filesize of downloaded file
# if it wasn't working its 0
filename=MagPi_"$latest_issues".pdf

# shellcheck disable=SC2002
filesize=$(cat ../issues/"$filename" | wc -c)

if [[ $filesize -gt 0 ]] ; then
echo "$latest_issues" >"$file"
if bash $(dirname "$0")/magpi-issue-downloader.sh -f "$latest_issues" -l "$latest_issues"; then
echo "Download was successful."
echo "$latest_issues" > "$file"
else
echo "Download failed."
rm ../issues/MagPi_"$latest_issues".pdf
fi

exit 0
exit 0

0 comments on commit d8cfbc5

Please sign in to comment.