Use type builtin to check for the existence of the curl command.

There is no need to actually execute curl in order to check that it exists on
the system, the type builtin can tell us without having to fork the command.
This commit is contained in:
Peter Ajamian 2021-05-07 16:41:51 +12:00
parent d643676189
commit 64dbbde473

View File

@ -23,7 +23,7 @@ if [[ "$(id -u)" -ne 0 ]]; then
"${errcolor}Either use sudo or 'su -c ${0}'$nocolor" "${errcolor}Either use sudo or 'su -c ${0}'$nocolor"
fi fi
if [[ "$(curl 2>/dev/null || echo $?)" == 127 ]]; then if ! type curl >/dev/null 2>&1; then
printf "${blue}Curl is not installed! Installing it...$nocolor" printf "${blue}Curl is not installed! Installing it...$nocolor"
dnf -y install curl libcurl dnf -y install curl libcurl
fi fi