Skip to content

Instantly share code, notes, and snippets.

@andygock
Last active June 2, 2017 09:34
Show Gist options
  • Save andygock/e77f7b5ee65e564037688d1e00b30974 to your computer and use it in GitHub Desktop.
Save andygock/e77f7b5ee65e564037688d1e00b30974 to your computer and use it in GitHub Desktop.
Bash script: Download latest stable LibreOffice for Windows x86
#!/bin/bash
#
# Download latest stable LibreOffice for Windows x86
#
urla=$(curl -s "https://www.libreoffice.org/download/download/" \
| grep "option.*type=win-x86\&" | head -n 2 | cut -d '"' -f 2 | tail -n 1)
urlb=$(curl -s "$urla" | grep "\.msi" | grep -v "torrent" | tail -n 1 | cut -d '"' -f 6)
urlc=$(curl -s "$urlb" | grep "Your download" | cut -d "'" -f 2)
if [ "$urlc" = "" ]; then
echo >&2 "Could not extract download URL"
exit 1
fi
wget "$urlc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment