Skip to content

Commit

Permalink
Bash Array for download command
Browse files Browse the repository at this point in the history
  • Loading branch information
djarbz committed Oct 24, 2024
1 parent 4a72b2e commit a2d8e72
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions kasmvnc/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@ download_file() {
local download_tool

if command -v curl &> /dev/null; then
download_tool="curl -fsSL"
# shellcheck disable=SC2034
download_tool=(curl -fsSL)
elif command -v wget &> /dev/null; then
download_tool="wget -q -O-"
# shellcheck disable=SC2034
download_tool=(wget -q -O-)
elif command -v busybox &> /dev/null; then
download_tool="busybox wget -O-"
# shellcheck disable=SC2034
download_tool=(busybox wget -O-)
else
echo "ERROR: No download tool available (curl, wget, or busybox required)"
exit 1
fi

$download_tool "$url" > "$output" || {
# shellcheck disable=SC2288
"$${download_tool[@]}" "$url" > "$output" || {
echo "ERROR: Failed to download $url"
exit 1
}
Expand Down

0 comments on commit a2d8e72

Please sign in to comment.