I'm trying to put a function inside of a script to install the latest version of TeamSpeak3 Client and make all configurations.My problem is I don't know how to make a function to test the version number part, number.number.number.number. The numbers range from 0 to 99.For example, I'm given a variable that has the value within a URL:URL=http://dl.4players.de/ts/releases/$version/TeamSpeak3-Client-linux_$arch-$version.runHere the variable, $Version, the latest is 3.0.16. The current latest URL is:http://dl.4players.de/ts/releases/3.0.16/TeamSpeak3-Client-linux_x86-3.0.16.runBut in the future when I use the script, I want it to determine automatically the latest version, checking the numbers within the URL.For archs I have this code:# Determining the system archarch=$(uname -m)case $arch inx86)    arch=x86  ;;i?86)   arch=x86  ;;amd64)  arch=amd64    ;;x86_64) arch=x86_64   ;;* ) echo Your Arch '$arch' -> Its not supported.  ;;esacMaybe an array or something like that? Can someone help me with this idea?
How I can determine the latest version in URL?
scripting;version;url
I'm not sure what it is you're asking exactly. Assuming you mean you want to find the latest version listed in http://dl.4players.de/ts/releases/, you can do this:curl -s http://dl.4players.de/ts/releases/ | \  grep -Po '(?<=href=)[0-9]+(\.[0-9]+){2,3}(?=/)' | \  sort -Vr | head -1Example output:3.0.16Explanation: Note that the directory listing HTML follows a fairly regular pattern:<tr><td valign=top><img src=/icons/folder.gif alt=[DIR]></td><td><a href=3.0.0/>3.0.0/</a></td><td align=right>10-Aug-2011 16:57  </td><td align=right>  - </td><td>&nbsp;</td></tr><tr><td valign=top><img src=/icons/folder.gif alt=[DIR]></td><td><a href=3.0.1/>3.0.1/</a></td><td align=right>17-Nov-2011 08:43  </td><td align=right>  - </td><td>&nbsp;</td></tr>All the version folder links are created with href=X.Y.Z[.A]/, A, X, Y and Z all being numbers.So we can grep for this pattern: (?<=href=)[0-9]+(\.[0-9]+){2,3}(?=/). I have used Perl regexes (-P) for lookaheads and lookbehinds (so that the string is surrounded by href= and /, but these two aren't part of the actual match). The regex [0-9]+(\.[0-9]+){2,3} means:One or more digits: [0-9]+, followed by,A group consisting of a period and one or more digits ((\.[0-9]+)), repeated two or three times ({2,3}).Then we do version sort and get the top result.Ordinarily, one should not use Regular expressions to parse HTML. However, I think on occasion an exception can be made.