Answer the question
In order to leave comments, you need to log in
CURL | How to download without knowing the version?
There is a link
github.com/adoptium/temurin8-binaries/releases/latest/OpenJDK8U-jdk_x64_windows_hotspot_8u322b06.msi
you need to make it so that instead of 8u322b06 you write something like %% and that this file is downloaded
Answer the question
In order to leave comments, you need to log in
it won’t work with one request, moreover, you need a mini program to get what you want, it’s more difficult on bash than on something more convenient (php / js / ...)
you need to get a list of releases of the selected repository, take the first link and download it already
in your example to get list in json format:
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/adoptium/temurin8-binaries/releases?per_page=1
In the Linux console, you can do this, bring it under Windows yourself, I don’t know how to use it
# Выяснить длинную версию последнего релиза:
LONG_VERSION=$(curl -s https://github.com/adoptium/temurin8-binaries/releases/latest | awk -F\" {'print $2'} | awk -F/ {'print $8'})
# Привести длинную версию последнего релиза к короткой:
SHORT_VERSION=$(echo $LONG_VERSION | awk -F- {'print $1$2'} | sed 's/jdk//')
# Скачать файл:
wget https://github.com/adoptium/temurin8-binaries/releases/download/$LONG_VERSION/OpenJDK8U-jdk_x64_windows_hotspot_$SHORT_VERSION.msi
get download link:
curl https://api.github.com/repos/adoptium/temurin8-binaries/releases/latest?per_page=1|grep -oP 'download_url": "\K.*OpenJDK8U-jdk_x64_windows_hotspot.*msi(?=")'
URL=$(curl https://api.github.com/repos/adoptium/temurin8-binaries/releases/latest?per_page=1|grep -oP 'download_url": "\K.*OpenJDK8U-jdk_x64_windows_hotspot.*msi(?=")')
curl -OL $URL
curl https://api.github.com/repos/adoptium/temurin8-binaries/releases/latest?per_page=1|grep -oP 'download_url": "\K.*OpenJDK8U-jdk_x64_windows_hotspot.*msi(?=")'|xargs curl -OL
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question