4 SCRIPTNAME
=termux-download
6 echo "Usage: $SCRIPTNAME [OPTIONS] <url-to-download>"
7 echo "Download a resource using the system download manager."
9 echo " -d <description> description for the download request notification"
10 echo " -t <title> title for the download request notification"
19 while getopts :hd
:t
: option
23 d
) ARG_D
="--es description"; OPT_D
="$OPTARG";;
24 t
) ARG_T
="--es title"; OPT_T
="$OPTARG";;
25 ?
) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
30 if [ $# -lt
1 ]; then echo "$SCRIPTNAME: no url specified"; exit 1; fi
31 if [ $# -gt
1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
36 if [ -n
"$ARG_D" ]; then set -- "$@" $ARG_D "$OPT_D"; fi
37 if [ -n
"$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi
38 set -- "$@" $URL_TO_DOWNLOAD
40 @TERMUX_API@ Download
"$@"