# 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"
-n, --number
Maximum number of files to download
- Default: none
+ Default: no limit
-a, --args \e[4m<args>\e[0m
String of shell arguments which are passed verbatim to wget\n"
# Validate arguments
#
+list='queue.txt'
+
while [ $# -gt 0 ]; do
case "$1" in
-l|--list)
fi
#
-# Recurse through list
+# Iterate through list
#
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