Search code examples
bashdownloadcomparisonversiondirectory-structure

How to parse folders of version numbers and extract the highest


Lets say there's the following structure in an SVN repository :

etc.

I'd like to do the following with a bash script :

  1. go through all the subdirectories of /branches
  2. find the highest version number
  3. download it

I'm new to bash, the download part is easy, but I'm stuck on the folder name extraction and comparison.


Solution

  • If your branches can be simply sorted, you can use something like this :

    svn list http://plugins.svn.wordpress.org/all-in-one-seo-pack/branches | sort | tail -n 1
    >>> 1.6.13/