Shell Script to compare versions of two plugins or jar files.

Siddharth Lakhani
1 min readFeb 14, 2021
Bash
Bash

When you are comparing the version of two jar files less than (<) and greater than (>) or equal to (=) operator will not work because the version of any file is always in a combination of characters and numbers.

So to compare the version of files sort command is used in the shell script.

In the script, the value of values of variables are hardcoded but we can fetch the value of variables by reading file names.

In if condition the file names are sorting by using sort -V command in ascending order and print topmost entry by using head command.

The code of this script can also be used in another shell script as one block and instead of using echo, we can use other commands to process patch updates and jar plugins.

References:

--

--