Trouble with downloading software with sh script

RLA_Group
New Contributor

Hi,
I'm currently using a very basic script to download some software:

currentUser=$(stat -f "%Su" /dev/console)
cd /tmp
curl -sS https://az764295.vo.msecnd.net/stable/ee428b0eead68bf0fb99ab5fdc4439be227b6281/VSCode-darwin-stable.zip > VSCode.zip
unzip VSCode.zip
rm -rf "/Applications/Visual Studio Code.app"
cp -R "Visual Studio Code.app" /Applications
rm -rf VSCode.zip
rm -rf "Visual Studio Code.app"
/bin/chmod -R +a "$currentUser allow read,write,delete" "/Applications/Visual Studio Code.app"

This works but every time a new version is released I have to update the URL in the script. Is there a way around this with some fancy scripting?

I have around 30 bits of software downloaded and installed in the same way and all have to manually be updated each time a new version is out. I'm hoping someone can give me an example on how to use a script to look for the latest version on the site and download that (if thats possible)

Thanks in advance

0 REPLIES 0