diff options
author | Erich Eckner <git@eckner.net> | 2018-07-13 15:10:17 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-13 15:10:17 +0200 |
commit | 56791c1b1cee584c26fb6b68537e8b5143774753 (patch) | |
tree | b8af3675e0ceb2ff722f8e61f4668c4ca2a90ac5 | |
parent | 630af7c3e2dd1b7bb95dd32471dcd69e275ba335 (diff) | |
download | buff-di-wuff-56791c1b1cee584c26fb6b68537e8b5143774753.tar.xz |
buff-di-wuff: really parse github :-)
-rwxr-xr-x | buff-di-wuff | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/buff-di-wuff b/buff-di-wuff index bcd1526..c86965f 100755 --- a/buff-di-wuff +++ b/buff-di-wuff @@ -12,34 +12,25 @@ mkdir -p \ grep '^[^#]' "$(dirname "$0")/downloads.list" | \ while read -r url urlDir; do - if [ -n "${urlDir}" ]; then - urlFile=$( - printf '%s\n' "${url}" | \ - sed ' - s|\.|\.|g - s|*|.*|g - ' - ) - wget --no-check-certificate -O - "${urlDir}" 2> /dev/null | \ - tr '"<>' '\n' | \ - grep "^${urlFile}\$" | \ - sort -u - elif echo "${url}" | \ - grep -q '\*[^/]*$'; then - urlDir=$( - printf '%s\n' "${url}" | \ - sed 's|/[^/]*$|/|' - ) + if [ -n "${urlDir}" ] || \ + echo "${url}" | \ + grep -q '\*[^/]*$'; then + if [ -z "${urlDir}" ]; then + urlDir=$( + printf '%s\n' "${url}" | \ + sed 's|/[^/]*$|/|' + ) + fi urlFile=$( printf '%s\n' "${url}" | \ sed ' s|^.*/|| - s|\.|\.|g + s|\.|\\.|g s|*|.*|g ' ) wget --no-check-certificate -O - "${urlDir}" 2> /dev/null | \ - tr '"<>' '\n' | \ + tr '"<>/' '\n' | \ grep "^${urlFile}\$" | \ sort -u | \ xargs -r printf "${urlDir}%s\n" |