Grab version number from website

anverhousseini
Contributor II

Hi

I'm creating an update script for the application Dropbox.app. Now I would like to grab the version number from https://www.dropbox.com/install. I tried with following shell command:.

#!/bin/sh
latestver=`/usr/bin/curl -s -A https://www.dropbox.com/install | egrep -o '<span id="version_str">* for Mac</span>'`

But it doesn't work. Any hint? Thanks!

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

This may help.
A code snippet from a script I have that gets the latest version info (and the full download location also, but on a separate line)

curl --connect-timeout 4 --max-time 4 -sf "https://www.dropbox.com/download?plat=mac&amp;full=1" 2>&1 | awk -F'"' '/<a href=/{print $2}' | awk -F"/" '{print $NF}' | sed -e 's/^Dropbox%20//;s/.dmg$//'

View solution in original post

4 REPLIES 4

mm2270
Legendary Contributor III

This may help.
A code snippet from a script I have that gets the latest version info (and the full download location also, but on a separate line)

curl --connect-timeout 4 --max-time 4 -sf "https://www.dropbox.com/download?plat=mac&amp;full=1" 2>&1 | awk -F'"' '/<a href=/{print $2}' | awk -F"/" '{print $NF}' | sed -e 's/^Dropbox%20//;s/.dmg$//'

anverhousseini
Contributor II

Thanks! Now it works.

anverhousseini
Contributor II

I saw that you created a UpdateCoreApps Script which contains an update script for Office 2011. Would it be possible to separate this part from the rest? So that I can use just the Office 2011 part?

mm2270
Legendary Contributor III

@anverhousseini I suppose it could, though its not necessary to do that. That script was designed so you can pass a string of whatever application you want it to check on and update (if needed) when the script is run. So you can just send "Office" to the parameter and it will only check on that application and skip everything else.

But, that script has basically been replaced by a more advanced version that I haven't published yet, so I can't guarantee that one will continue to work. I'm not updating that older script anymore. I also plan on incorporating Office 2016 into the new one at some point, but I haven't worked on that yet.