Andrew's git
/
scripts.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
nameget.sh bugfixing
author
Andrew Lorimer
<andrew@lorimer.id.au>
Wed, 15 Jun 2022 02:27:13 +0000
(12:27 +1000)
committer
Andrew Lorimer
<andrew@lorimer.id.au>
Wed, 15 Jun 2022 02:27:13 +0000
(12:27 +1000)
nameget.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
f77f899
)
diff --git
a/nameget.sh
b/nameget.sh
index 063544c84280843d23f6d42354adfcf2b81d5d59..943ce75efa6e64f246d863c696c65e0adf9be535 100755
(executable)
--- a/
nameget.sh
+++ b/
nameget.sh
@@
-5,7
+5,7
@@
# Andrew Lorimer https://lorimer.id.au
#
# Andrew Lorimer https://lorimer.id.au
#
-VERSION="
0.9
"
+VERSION="
1.0
"
LOGTAG="$(basename "$0")"
LOGFILE=/var/log/nameget
BADWORDS="error\|failure\|unable\|denied\|directory"
LOGTAG="$(basename "$0")"
LOGFILE=/var/log/nameget
BADWORDS="error\|failure\|unable\|denied\|directory"
@@
-42,7
+42,7
@@
Get a list of urls and optional corresponding output paths, then send them to wg
-n, --number
Maximum number of files to download
-n, --number
Maximum number of files to download
- Default: no
ne
+ Default: no
limit
-a, --args \e[4m<args>\e[0m
String of shell arguments which are passed verbatim to wget\n"
-a, --args \e[4m<args>\e[0m
String of shell arguments which are passed verbatim to wget\n"
@@
-60,6
+60,8
@@
fi
# Validate arguments
#
# Validate arguments
#
+list='queue.txt'
+
while [ $# -gt 0 ]; do
case "$1" in
-l|--list)
while [ $# -gt 0 ]; do
case "$1" in
-l|--list)
@@
-132,7
+134,7
@@
if [[ ! $outdir =~ /$ ]]; then # check if [DESTINATION] has a trailing /
fi
#
fi
#
-#
Recurs
e through list
+#
Iterat
e through list
#
#
@@
-166,11
+168,7
@@
while read -r url filename; do
if [ "$test" ]; then
output "$command" " "
else
if [ "$test" ]; then
output "$command" " "
else
- if [ "$EUID" -ne 0 ]; then # get stdout of command
- wgetout=$($command | tee /dev/tty) # get stdout of command
- else
- wgetout=$($command 2>&1 > /dev/null) # get stderr of command
- fi
+ wgetout=$(bash -c "($command)" 2>&1) # get stdout of command
exitcode=$?
failures=$(echo "$wgetout" | grep -i "$badwords")
if [ $exitcode -eq 0 ] && [ -z "$failures" ]; then
exitcode=$?
failures=$(echo "$wgetout" | grep -i "$badwords")
if [ $exitcode -eq 0 ] && [ -z "$failures" ]; then