-1

I want to be able to have a generic link to the latest version on of file available for download to make things easier for clients. Example: http://server.web.net/Adium/Adium-1.5.10.4.pkg If it could be http://server.web.net/Adium/LATEST

The scripting side works fine, I just can't figure out the alias/link part.

latestfile=`find *.pkg | sort | tail -n 1`
echo $latestfile

This gets the correct file.

  • Not sure I follow your question, but the answer seems to be to store the latest file on the server as “latest.pkg” and replace it as often as necessary - the download script will always take that one... – Solar Mike Jul 30 '18 at 8:43
  • 1
    What you yo mean you can't figure out the alias/link part? When you create the link, what fails? – Allan Jul 30 '18 at 8:54
  • 1
    This question should not be put on hold because of "software development", as the rules clearly specify that shell scripting questions are encouraged here. – jksoegaard Jul 30 '18 at 13:08
  • @user2720970 To answer your question: You can create the link using the following command: "ln -s $latestfile LATEST". – jksoegaard Jul 30 '18 at 13:08
  • @jksoegaard now that the question is reopened, you might want to write/expand that into an answer. – Glorfindel Jul 31 '18 at 11:59
1

You can create a symbolik link using the following command:

ln -s "$latestfile" LATEST

When you access LATEST you will really access the actual file, so no copying of data takes place - and no extra space is used.

Depending on your web server, you might need to allow the use of symbolic links for that directory.

  • 1
    ln -sf ... might be safer to avoid errors if a LATEST already exists – nohillside Jul 31 '18 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .