Andrew's git
/
scripts.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
optional destination file, verbose debugging for wget in syslog
author
Andrew Lorimer
<andrew@charles.cortex>
Mon, 24 Dec 2018 04:21:54 +0000
(15:21 +1100)
committer
Andrew Lorimer
<andrew@charles.cortex>
Mon, 24 Dec 2018 04:21:54 +0000
(15:21 +1100)
nameget.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
05a9d27
)
diff --git
a/nameget.sh
b/nameget.sh
index edc1e2e27b89c6ecf1ba30e63a96a741be2ca2a8..b0835689b9a6b181b4c3c22ace1fc3162a9a49b1 100755
(executable)
--- 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
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
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
fi
done < $list