commit 6243f4e5f5f4d96ffa75bb4484e1f1a2eb97cb27
parent 39403448f2d3ba7a1f423bcf3ae03d69271a6c45
Author: hhvn <dev@hhvn.uk>
Date: Fri, 30 Jul 2021 00:54:39 +0100
.s/b/netdownload: use sha256sum of uri as filename
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.scripts/bin/netdownload b/.scripts/bin/netdownload
@@ -55,7 +55,7 @@ case "$1" in
mkdir -p "$dir"
- file="$dir/$(echo "$uri" | uri2file)"
+ file="$dir/$(echo "$uri" | sha256sum | awk '{print $1}')"
[ -f "$file" ] &&
printf "ERROR: File '%s' already exits: skipping '%s'\n" "$file" "$uri" &&
continue
@@ -69,6 +69,6 @@ case "$1" in
continue
printf "Downloaded '%s' as %s\n" "$uri" "$file"
- done < "$1"
+ done < "${1:-/dev/stdin}"
;;
esac