# Get the path to Bash executable EXEC_SHELL_PATH=$(command -v bash) # Specify the download folder download_folder="$HOME/wallpapers" # Check if no URLs are provided if [ "$#" -eq 0 ]; then echo "Error: No URLs specified." echo "Usage: $EXEC_SHELL_PATH $0 [ ...]" exit 1 fi # Loop through each URL provided as a command-line argument for url in "$@" do # Skip the first argument (script name) if it's not a URL if [[ "$url" == "$0" ]]; then continue fi # Extract filename from URL filename=$(basename "$url") output_filename="${download_folder}/${filename}.jpeg" # Specify the full path for the output file # Download the file using wget to the specified output filename wget "$url" -O "$output_filename" # Check if the download was successful if [ $? -eq 0 ]; then echo "File successfully downloaded to: $output_filename" else echo "Error: Download failed for URL: $url" fi done