Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 13
    At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1 Commented May 27, 2016 at 23:52
  • 3
    This breaks if there are '%' signs in the print statement. Better replace printf "$requiredver\n$currentver" with printf '%s\n' "$requiredver" "$currentver". Commented Nov 5, 2016 at 10:50
  • 1
    -V is a GNU extension of sort(1) thus this solution is non-portable. Commented Sep 4, 2017 at 0:46
  • 1
    sort -n works pretty much the same way in case of numeral versions. Commented Nov 22, 2017 at 7:22
  • 1
    @LucianoAndressMartini, see what you think of my edit. Commented Jan 22, 2018 at 23:28