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:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response