From: Andrew Lorimer Date: Mon, 24 Dec 2018 04:22:02 +0000 (+1100) Subject: Merge branch 'master' of /tank/andrew/code/scripts X-Git-Url: https://git.lorimer.id.au/scripts.git/diff_plain/1535dcba7e1d12927c5c554e1f62212b9c53c6a9?hp=b30331a29a09b2e0c975382850fea0a44a6ab17f Merge branch 'master' of /tank/andrew/code/scripts --- diff --git a/nameget.sh b/nameget.sh index edc1e2e..b083568 100755 --- a/nameget.sh +++ b/nameget.sh @@ -28,11 +28,15 @@ otherargs=$@ # set aside remaining arguments for passing to wget logger -s -t $LOGTAG "starting downloading files in $list" while read -r url filename; do - if wget --cut-dirs=100 -np -e robots=off -O $outdir$filename $otherargs $url; then + destarg = '' + if [ -n "$filename" ]; then + $destarg = " -O $outdir$filename" + + if output=$(wget --cut-dirs=100 -np -e robots=off -P $outdir$destarg $otherargs $url); then sed -i "/$filename/d" $list echo $filename logger -s -t $LOGTAG "downloaded $filename" else - logger -s -t $LOGTAG "downloading of $filename from $url failed." + logger -s -t $LOGTAG "downloading of $filename from $url failed: $output" fi done < $list