}
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