Commit 1e314ded authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: allow separated mask for urls

parent fe3b65e5
...@@ -184,15 +184,22 @@ if echo "$1" | grep -q "^ftp://" ; then ...@@ -184,15 +184,22 @@ if echo "$1" | grep -q "^ftp://" ; then
exit exit
fi fi
# drop mask part # mask allowed only in the last part of path
URL="$(dirname "$1")/" MASK=$(basename "$1")
# if mask are second arg
if [ -n "$2" ] ; then
URL="$1"
MASK="$2"
else
# drop mask part
URL="$(dirname "$1")"
fi
if echo "$URL" | grep -q "[*?]" ; then if echo "$URL" | grep -q "[*?]" ; then
fatal "Error: there are globbing symbols (*?) in $URL" fatal "Error: there are globbing symbols (*?) in $URL"
fi fi
# mask allowed only in the last part of path
MASK=$(basename "$1")
# If have no wildcard symbol like asterisk, just download # If have no wildcard symbol like asterisk, just download
if echo "$MASK" | grep -qv "[*?]" || echo "$MASK" | grep -q "[?].*="; then if echo "$MASK" | grep -qv "[*?]" || echo "$MASK" | grep -q "[?].*="; then
...@@ -216,7 +223,7 @@ fi ...@@ -216,7 +223,7 @@ fi
ERROR=0 ERROR=0
for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do
sget "$URL$(basename "$fn")" || ERROR=1 sget "$URL/$(basename "$fn")" || ERROR=1
done done
exit $ERROR exit $ERROR
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment