add helpers library
This commit is contained in:
18
.config/yadm/bootstrap.d/lib/helpers
Normal file
18
.config/yadm/bootstrap.d/lib/helpers
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Download file and return filename
|
||||
download() {
|
||||
[[ $# == 0 ]] && exit 1
|
||||
|
||||
local url="$1"
|
||||
local suffix="${2:-"${url##*.}"}"
|
||||
local filename="$(mktemp -t "download-XXXXXX.${suffix}")"
|
||||
|
||||
curl --location --output "${filename}" -# "${url}"
|
||||
|
||||
echo "${filename}"
|
||||
}
|
||||
|
||||
test() {
|
||||
echo "Test function"
|
||||
}
|
||||
Reference in New Issue
Block a user