importation initiale dans git
This commit is contained in:
37
geturl
Executable file
37
geturl
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: Télécharger un fichier avec wget ou curl
|
||||
|
||||
USAGE
|
||||
$scriptname <file.url|file.desktop|URL> [wget options]"
|
||||
}
|
||||
|
||||
source "$(dirname "$0")/ulib/ulib" &&
|
||||
urequire DEFAULTS ||
|
||||
exit 1
|
||||
|
||||
parse_opts + "${PRETTYOPTS[@]}" \
|
||||
--help '$exit_with display_help' \
|
||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||
|
||||
url="$("$scriptdir/caturl" "$1")" || die
|
||||
shift
|
||||
|
||||
filename="$(basename "$url")"
|
||||
if progexists wget; then
|
||||
if [ -f "$filename" ]; then
|
||||
wget -c "$@" "$url"
|
||||
else
|
||||
wget "$@" "$url"
|
||||
fi
|
||||
elif progexists curl; then
|
||||
if [ -f "$filename" ]; then
|
||||
curl -C - -o "$filename" "$@" "$url"
|
||||
else
|
||||
curl -o "$filename" "$@" "$url"
|
||||
fi
|
||||
else
|
||||
die "Aucune méthode de téléchargement n'a été détectée"
|
||||
fi
|
||||
Reference in New Issue
Block a user