diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-03-26 15:03:25 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-03-26 15:07:50 -0500 |
commit | 9f3c0141424fe8dd2d38255373a3e46bc23f13fb (patch) | |
tree | 8046c48a8cc6f67305e1d66f5e9596f441bb63ac /functions.sh | |
parent | b1f91cc0a928cd08c01605498e151eda8dbcce4a (diff) |
Create a script exporting separate functions and remove download function from downloads script. Reformat MD5 mismatch failed message.
Diffstat (limited to 'functions.sh')
-rw-r--r-- | functions.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/functions.sh b/functions.sh new file mode 100644 index 0000000..d2ff5be --- /dev/null +++ b/functions.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +download() +{ + tput civis + local url=$1 + echo -n " " + wget -nc -q --show-progress --progress=dot "$url" 2>&1 | grep --line-buffered "%" | \ + sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}' + local retval="${PIPESTATUS[0]}" + if [ "${retval}" -ne 0 ]; then + printf "%b" "${RED}FAILED! WGET EXIT (${retval})\n${RST}" + exit "${retval}" + fi + printf "%b" "\b\b\b\b\n" + tput cnorm +} + +export -f download |