A recursive bash script that fetches curl
using wget
which is another UNIX tool to fetch outside binaries and other things.
It's simple, it's a bash script that fetches curl, using wget. It can't get anymore recursive than this. It also has a reversal
mode, where you can fetch wget with curl.
Open up a terminal and run:
chmod +x ./curl_fetch.sh
./curl_fetch.sh # You may want to disable TLS if this fails, just add the --without-ssl conditional.
If you want TLS, you can select from these conditionals to add:
--with-amissl
--with-bearssl
--with-gnutls
--with-mbedtls
--with-mesalink
--with-nss
--with-openssl (also works for BoringSSL and libressl)
--with-rustls
--with-schannel
--with-secure-transport
--with-wolfssl
So say if you pick --with-openssl
the command would look like this: ./curl_fetch.sh --with-openssl
.
Sometimes fetching curl
using wget
may not work, in this scenario you'll want to try using wget
to fetch curl
, then again retrying fetching curl using wget
to the latest version:
# Set the URL for downloading wget
WGET_URL="https://ftp.gnu.org/gnu/wget/wget-latest.tar.gz"
WGET_TARBALL="wget.tar.gz"
if curl -o "${WGET_TARBALL}" "${WGET_URL}"; then
echo "wget downloaded successfully with curl. The circle is complete."
else
echo "Failed to download wget with curl. The irony!"
fi
}
fetch_wget
- More recursion in the script, so for example:
if wget "${CURL_URL}" -O "${CURL_TARBALL}"; then
echo "Download complete. But wait, let's download it again for good measure!"
download_curl
else
echo "Error downloading curl. But maybe it'll work if we try again?"
download_curl
fi
}
I'm in the process of making a newsletter to keeping you up-to-date on all the updates.
This was created by Michael Mendy in association with Dude Solutions, LLC.