Accept a name for dl and include starter script file master
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 26 Apr 2023 16:27:12 +0000 (12:27 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 26 Apr 2023 16:27:12 +0000 (12:27 -0400)
home/lib/login_functions.sh

index 4f62b82..56e0c2b 100644 (file)
@@ -26,13 +26,30 @@ notify_done() {
     fi
 }
 
+_dl_script() {
+cat << EOF
+#! /bin/bash
+wget -c \$(< ./url)
+EOF
+}
+
 dl() {
+    local -r name="$1"
+    local -r url="$2"
+
     local -r timestamp="$(date --iso-8601=ns)"
-    local -r dir="$HOME"/dl/adhoc/"$timestamp"
+    local -r dir="$HOME"/dl/adhoc/"$timestamp"--"$name"
     local -r url_file_path="${dir}/url"
+    local -r dl_file_path="${dir}/dl"
 
     mkdir -p "$dir"
     touch "$url_file_path"
+    if [ "$url" != '' ]
+    then
+        echo "$url" > "$url_file_path"
+    fi
+    _dl_script > "$dl_file_path"
+    chmod +x "$dl_file_path"
     cd "$dir"
 }
 
This page took 0.032184 seconds and 4 git commands to generate.