Skip to content

Instantly share code, notes, and snippets.

@richlander
Created January 8, 2025 21:06
Show Gist options
  • Save richlander/7a78d0421b68554e8cccab33704937c8 to your computer and use it in GitHub Desktop.
Save richlander/7a78d0421b68554e8cccab33704937c8 to your computer and use it in GitHub Desktop.
Diff Script
#!/bin/bash
# Define URLs in an array
URLS=(
"dotnet-install.sh"
"dotnet-install.ps1"
# "dotnet-install.asc"
# "dotnet-install.sig"
)
# Function to fetch and compare two URLs
compare_urls() {
local url1=$1
local url2=$2
echo "Comparing:"
echo "- $url2"
echo "- $url2"
diff -q <(curl -s "$url1") <(curl -s "$url2")
if [ $? -eq 0 ]; then
echo "Files match"
else
echo "Differences found"
fi
echo ""
}
GITHUB="https://raw.githubusercontent.com/dotnet/install-scripts/refs/heads/main/src/"
DOTNETCDN="https://builds.dotnet.microsoft.com/dotnet/scripts/v1/"
SHORTLINK="https://dot.net/v1/"
DOMAIN1=$DOTNETCDN
DOMAIN2=$GITHUB
for url in "${URLS[@]}"; do
URL1=$DOMAIN1$url
URL2=$DOMAIN2$url
compare_urls $URL1 $URL2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment