#!/bin/bash # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 source "$(dirname "$0")/lib/ulib/ulib" || exit 1 urequire DEFAULTS function display_help() { uecho "$scriptname: Télécharger un fichier avec wget ou curl USAGE $scriptname [wget options]" } 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