Here's a simple shell script that uses wget or curl to download a file and saves it with the name "catch".
#!/bin/bash
# Check if wget is installed
if ! command -v wget &>/dev/null; then
echo "wget not found. Installing wget..."
sudo apt-get install -y wget
fi
# Check if curl is installed
if ! command -v curl &>/dev/null; then
echo "curl not found. Installing curl..."
sudo apt-get install -y curl
fi
# Download file using wget
wget -O catch http://example.com/path/to/file.ext
# If wget fails, try using curl
if [ $? -ne 0 ]; then
echo "wget failed. Trying curl..."
curl -O http://example.com/path/to/file.ext
fi
Replace http://example.com/path/to/file.ext with the URL of the file you want to download. This script first checks if wget and curl are installed, and if not, it installs them. Then it tries to download the file using wget. If wget fails, it tries to download the file using curl.
Save this script as a .sh file, make it executable with chmod +x script.sh, and run it with ./script.sh.
References: