#!/usr/bin/env bash # lists all available versions listed for a package in a site (http) scriptName=list-archive-two-level-versions # do not use the .wrapped name usage() { echo "Usage: $scriptName [ []]" } archive="$1" # archive url pname="$2" # package name file="$3" # file for writing debugging information if [ -z "$archive" ]; then echo "$scriptName: Missing archive url" usage exit 1 fi # print a debugging message if [ -n "$file" ]; then echo "# Listing versions for $pname at $archive" >> $file fi # list all major-minor versions from archive tags1=$(curl -sS "$archive/") tags1=$(echo "$tags1" | sed -rne 's,^.*,\1,p') # print available versions for tag in $tags1; do tags2=$(curl -sS "$archive/$tag/") tags2=$(echo "$tags2" | sed -rne "s,^.*,\\1,p") echo "$tags2" done