From 294704a27661b5c136e959c3abbb380a5fc12362 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 2 Jan 2014 15:33:22 -0500 Subject: [PATCH] gentoo: att: support multiple files --- .profile.d/gentoo.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.profile.d/gentoo.sh b/.profile.d/gentoo.sh index 1f29037..24e10ad 100644 --- a/.profile.d/gentoo.sh +++ b/.profile.d/gentoo.sh @@ -114,16 +114,21 @@ ec() { } att() { - declare url=$1 tmp=$(mktemp) filename || return 1 - [[ $url == */* ]] || url="http://bugs.gentoo.org/attachment.cgi?id=$url" - eval $(wget -S -O"$tmp" "$url" 2>&1 | tee /dev/tty | \ - grep 'Content-disposition:' | sed 's/.* //') && \ - mv "$tmp" "$filename" && \ - chmod $(printf "%03o" "$((0666 & ~$(umask)))") "$filename" && \ - ls -l "$filename" && \ - return 0 - rm -f "$tmp" - return 1 + while [[ $# -gt 0 ]] ; do + declare url=$1 tmp=$(mktemp) filename || return 1 + [[ ${url} == */* ]] || url="http://bugs.gentoo.org/attachment.cgi?id=${url}" + printf '%s -> ' "${url}" + if eval $(wget -S -O"${tmp}" "${url}" 2>&1 | + grep 'Content-disposition:' | sed 's/.* //') && \ + mv "${tmp}" "${filename}" && \ + chmod $(printf "%03o" "$((0666 & ~$(umask)))") "${filename}" ; then + du -b "${filename}" + else + echo "FAIL" + rm -f "${tmp}" + fi + shift + done } arch_emails() { local ret -- 2.39.5