From 6cfb2a5b9fc5da2d85c3d08504c26b4daf19eb18 Mon Sep 17 00:00:00 2001 From: Jan Jastrow Date: Mon, 29 Apr 2024 23:11:47 +0200 Subject: [PATCH] Add simple download function --- zsh/scripts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zsh/scripts b/zsh/scripts index eb2b0ab..c97b15b 100644 --- a/zsh/scripts +++ b/zsh/scripts @@ -99,6 +99,19 @@ function extract () { fi } +# Download provided url to $HOME/Downloads +function dl() { + if [ -z "$1" ]; then + echo "usage: dl url (directory)" + return + fi + if [[ -x $(which aria2) ]]; then + aria2c --dir="$HOME/Downloads" --continue=true --max-connection-per-server=5 "$1" + else + (cd "$HOME/Downloads" && curl -O "$1") + fi +} + # Monitor IP/Host and report with Pushover pnotify-online() { local ip_address="$1"