Created
March 8, 2024 05:46
-
-
Save VioletVivirand/1d55e500bcf7cc80e9759bcb160b1a1c to your computer and use it in GitHub Desktop.
A Bash script to download files of a Gist answered by Gemini model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gist_id="YOUR_GIST_ID" # Replace with the actual Gist ID | |
download_path="." # Specify the download directory (optional) | |
# Get Gist information as JSON | |
gist_info=$(curl -s "https://api.github.com/gists/$gist_id") | |
# Extract file URLs using jq | |
file_urls=$(echo "$gist_info" | jq -r '.files[].raw_url') | |
# Loop through URLs and download files | |
for url in $file_urls; do | |
filename=$(basename "$url") # Extract filename from URL | |
curl -o "$download_path/$filename" "$url" | |
echo "Downloaded: $filename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment