How to compare a program's version in a shell script?

Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
Suppose I want to compare gcc version to see whether the system has the minimum version installed or not.
To check the gcc version, I executed the following
gcc --version | head -n1 | cut -d" " -f4
The output was
4.8.5
So, I wrote a simple if statement to check this version against some other value
if [ "$(gcc --version | head -n1 | cut -d" " -f4)" -lt 5.0.0 ]; then
echo "Less than 5.0.0"
else
echo "Greater than 5.0.0"
fi
But it throws an error:
[: integer expression expected: 4.8.5
I understood my mistake that I was using strings to compare and the -lt requires integer. So, is there any other way to compare the versions?
shell-script test version numeric-data
add a comment |
up vote
5
down vote
favorite
Suppose I want to compare gcc version to see whether the system has the minimum version installed or not.
To check the gcc version, I executed the following
gcc --version | head -n1 | cut -d" " -f4
The output was
4.8.5
So, I wrote a simple if statement to check this version against some other value
if [ "$(gcc --version | head -n1 | cut -d" " -f4)" -lt 5.0.0 ]; then
echo "Less than 5.0.0"
else
echo "Greater than 5.0.0"
fi
But it throws an error:
[: integer expression expected: 4.8.5
I understood my mistake that I was using strings to compare and the -lt requires integer. So, is there any other way to compare the versions?
shell-script test version numeric-data
@123 Nothing happens
– Abhimanyu Saharan
May 27 '16 at 14:21
1
There's also a Stack Overflow question with a bunch of different suggestions for comparing version strings.
– n.st
May 29 '16 at 3:31
1
Much simpler than using pipes:gcc -dumpversion
– Victor Lamoine
Jan 4 '17 at 14:18
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
Suppose I want to compare gcc version to see whether the system has the minimum version installed or not.
To check the gcc version, I executed the following
gcc --version | head -n1 | cut -d" " -f4
The output was
4.8.5
So, I wrote a simple if statement to check this version against some other value
if [ "$(gcc --version | head -n1 | cut -d" " -f4)" -lt 5.0.0 ]; then
echo "Less than 5.0.0"
else
echo "Greater than 5.0.0"
fi
But it throws an error:
[: integer expression expected: 4.8.5
I understood my mistake that I was using strings to compare and the -lt requires integer. So, is there any other way to compare the versions?
shell-script test version numeric-data
Suppose I want to compare gcc version to see whether the system has the minimum version installed or not.
To check the gcc version, I executed the following
gcc --version | head -n1 | cut -d" " -f4
The output was
4.8.5
So, I wrote a simple if statement to check this version against some other value
if [ "$(gcc --version | head -n1 | cut -d" " -f4)" -lt 5.0.0 ]; then
echo "Less than 5.0.0"
else
echo "Greater than 5.0.0"
fi
But it throws an error:
[: integer expression expected: 4.8.5
I understood my mistake that I was using strings to compare and the -lt requires integer. So, is there any other way to compare the versions?
shell-script test version numeric-data
shell-script test version numeric-data
edited Jun 29 '16 at 23:58
Jeff Schaller
37k1052121
37k1052121
asked May 27 '16 at 14:01
Abhimanyu Saharan
285619
285619
@123 Nothing happens
– Abhimanyu Saharan
May 27 '16 at 14:21
1
There's also a Stack Overflow question with a bunch of different suggestions for comparing version strings.
– n.st
May 29 '16 at 3:31
1
Much simpler than using pipes:gcc -dumpversion
– Victor Lamoine
Jan 4 '17 at 14:18
add a comment |
@123 Nothing happens
– Abhimanyu Saharan
May 27 '16 at 14:21
1
There's also a Stack Overflow question with a bunch of different suggestions for comparing version strings.
– n.st
May 29 '16 at 3:31
1
Much simpler than using pipes:gcc -dumpversion
– Victor Lamoine
Jan 4 '17 at 14:18
@123 Nothing happens
– Abhimanyu Saharan
May 27 '16 at 14:21
@123 Nothing happens
– Abhimanyu Saharan
May 27 '16 at 14:21
1
1
There's also a Stack Overflow question with a bunch of different suggestions for comparing version strings.
– n.st
May 29 '16 at 3:31
There's also a Stack Overflow question with a bunch of different suggestions for comparing version strings.
– n.st
May 29 '16 at 3:31
1
1
Much simpler than using pipes:
gcc -dumpversion– Victor Lamoine
Jan 4 '17 at 14:18
Much simpler than using pipes:
gcc -dumpversion– Victor Lamoine
Jan 4 '17 at 14:18
add a comment |
3 Answers
3
active
oldest
votes
up vote
12
down vote
accepted
I don't know if it is beautiful, but it is working for every version format I know.
#!/bin/bash
currentver="$(gcc -dumpversion)"
requiredver="5.0.0"
if [ "$(printf '%sn' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
echo "Greater than or equal to 5.0.0"
else
echo "Less than 5.0.0"
fi
(Note: better version by the user 'wildcard': https://unix.stackexchange.com/users/135943/wildcard , removed additional condition)
or you could usesort's own checking facilitiesif printf '%sn%sn' "$(gcc --version | head -n1 | awk 'print $NF')" 5.0.0 | sort -cV; then echo 'less'; else echo 'more'; fi- admittedly less readable
– iruvar
May 27 '16 at 15:23
2
At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1
– Xiong Chiamiov
May 27 '16 at 23:52
2
This breaks if there are '%' signs in the print statement. Better replaceprintf "$requiredvern$currentver"withprintf '%sn' "$requiredver" "$currentver".
– phk
Nov 5 '16 at 10:50
1
-Vis a GNU extension ofsort(1)thus this solution is non-portable.
– stefanct
Sep 4 '17 at 0:46
1
@LucianoAndressMartini, see what you think of my edit.
– Wildcard
Jan 22 at 23:28
|
show 2 more comments
up vote
1
down vote
Here I give a solution for comparing Unix Kernel versions. And it should work for others such as gcc. I only care for the first 2 version number but you can add another layer of logic. It is one liner and I wrote it in multiple line for understanding.
check_linux_version()
version_good=$(uname -r
You can modify this and use it for gcc version checking.
+1 it is compatible with other Unix-like ? (My solution is not)
– Luciano Andress Martini
Feb 28 at 18:44
add a comment |
up vote
0
down vote
We used to do a lot of version checking in a GNU makefile. We shelled out through the makefile facilities. We had to detect old Binutils and buggy compilers and workaround them on the fly.
The pattern we used was:
#!/usr/bin/env bash
CC=$(command -v gcc)
GREP=$(command -v grep)
# Fixup CC and GREP as needed. It may be needed on AIX, BSDs, and Solaris
if [[ -f "/usr/gnu/bin/grep" ]]; then
GREP="/usr/gnu/bin/grep"
elif [[ -f "/usr/linux/bin/grep" ]]; then
GREP="/usr/linux/bin/grep"
elif [[ -f "/usr/xpg4/bin/grep" ]]; then
GREP="/usr/xpg4/bin/grep"
fi
# Check compiler for GCC 4.8 or later
GCC48_OR_LATER=$("$CXX" -v 2>&1 | "$GREP" -i -c -E "gcc version (4.[8-9]|[5-9].)")
if [[ "$GCC48_OR_LATER" -ne 0 ]];
then
...
fi
# Check assembler for GAS 2.19 or later
GAS219_OR_LATER=$("$CXX" -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | "$GREP" -c -E "GNU assembler version (2.19|2.[2-9]|[3-9])")
if [[ "$GAS219_OR_LATER" -ne 0 ]];
then
...
fi
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
12
down vote
accepted
I don't know if it is beautiful, but it is working for every version format I know.
#!/bin/bash
currentver="$(gcc -dumpversion)"
requiredver="5.0.0"
if [ "$(printf '%sn' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
echo "Greater than or equal to 5.0.0"
else
echo "Less than 5.0.0"
fi
(Note: better version by the user 'wildcard': https://unix.stackexchange.com/users/135943/wildcard , removed additional condition)
or you could usesort's own checking facilitiesif printf '%sn%sn' "$(gcc --version | head -n1 | awk 'print $NF')" 5.0.0 | sort -cV; then echo 'less'; else echo 'more'; fi- admittedly less readable
– iruvar
May 27 '16 at 15:23
2
At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1
– Xiong Chiamiov
May 27 '16 at 23:52
2
This breaks if there are '%' signs in the print statement. Better replaceprintf "$requiredvern$currentver"withprintf '%sn' "$requiredver" "$currentver".
– phk
Nov 5 '16 at 10:50
1
-Vis a GNU extension ofsort(1)thus this solution is non-portable.
– stefanct
Sep 4 '17 at 0:46
1
@LucianoAndressMartini, see what you think of my edit.
– Wildcard
Jan 22 at 23:28
|
show 2 more comments
up vote
12
down vote
accepted
I don't know if it is beautiful, but it is working for every version format I know.
#!/bin/bash
currentver="$(gcc -dumpversion)"
requiredver="5.0.0"
if [ "$(printf '%sn' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
echo "Greater than or equal to 5.0.0"
else
echo "Less than 5.0.0"
fi
(Note: better version by the user 'wildcard': https://unix.stackexchange.com/users/135943/wildcard , removed additional condition)
or you could usesort's own checking facilitiesif printf '%sn%sn' "$(gcc --version | head -n1 | awk 'print $NF')" 5.0.0 | sort -cV; then echo 'less'; else echo 'more'; fi- admittedly less readable
– iruvar
May 27 '16 at 15:23
2
At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1
– Xiong Chiamiov
May 27 '16 at 23:52
2
This breaks if there are '%' signs in the print statement. Better replaceprintf "$requiredvern$currentver"withprintf '%sn' "$requiredver" "$currentver".
– phk
Nov 5 '16 at 10:50
1
-Vis a GNU extension ofsort(1)thus this solution is non-portable.
– stefanct
Sep 4 '17 at 0:46
1
@LucianoAndressMartini, see what you think of my edit.
– Wildcard
Jan 22 at 23:28
|
show 2 more comments
up vote
12
down vote
accepted
up vote
12
down vote
accepted
I don't know if it is beautiful, but it is working for every version format I know.
#!/bin/bash
currentver="$(gcc -dumpversion)"
requiredver="5.0.0"
if [ "$(printf '%sn' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
echo "Greater than or equal to 5.0.0"
else
echo "Less than 5.0.0"
fi
(Note: better version by the user 'wildcard': https://unix.stackexchange.com/users/135943/wildcard , removed additional condition)
I don't know if it is beautiful, but it is working for every version format I know.
#!/bin/bash
currentver="$(gcc -dumpversion)"
requiredver="5.0.0"
if [ "$(printf '%sn' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
echo "Greater than or equal to 5.0.0"
else
echo "Less than 5.0.0"
fi
(Note: better version by the user 'wildcard': https://unix.stackexchange.com/users/135943/wildcard , removed additional condition)
edited Jan 23 at 15:24
answered May 27 '16 at 14:27
Luciano Andress Martini
3,345930
3,345930
or you could usesort's own checking facilitiesif printf '%sn%sn' "$(gcc --version | head -n1 | awk 'print $NF')" 5.0.0 | sort -cV; then echo 'less'; else echo 'more'; fi- admittedly less readable
– iruvar
May 27 '16 at 15:23
2
At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1
– Xiong Chiamiov
May 27 '16 at 23:52
2
This breaks if there are '%' signs in the print statement. Better replaceprintf "$requiredvern$currentver"withprintf '%sn' "$requiredver" "$currentver".
– phk
Nov 5 '16 at 10:50
1
-Vis a GNU extension ofsort(1)thus this solution is non-portable.
– stefanct
Sep 4 '17 at 0:46
1
@LucianoAndressMartini, see what you think of my edit.
– Wildcard
Jan 22 at 23:28
|
show 2 more comments
or you could usesort's own checking facilitiesif printf '%sn%sn' "$(gcc --version | head -n1 | awk 'print $NF')" 5.0.0 | sort -cV; then echo 'less'; else echo 'more'; fi- admittedly less readable
– iruvar
May 27 '16 at 15:23
2
At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1
– Xiong Chiamiov
May 27 '16 at 23:52
2
This breaks if there are '%' signs in the print statement. Better replaceprintf "$requiredvern$currentver"withprintf '%sn' "$requiredver" "$currentver".
– phk
Nov 5 '16 at 10:50
1
-Vis a GNU extension ofsort(1)thus this solution is non-portable.
– stefanct
Sep 4 '17 at 0:46
1
@LucianoAndressMartini, see what you think of my edit.
– Wildcard
Jan 22 at 23:28
or you could use
sort's own checking facilities if printf '%sn%sn' "$(gcc --version | head -n1 | awk 'print $NF')" 5.0.0 | sort -cV; then echo 'less'; else echo 'more'; fi - admittedly less readable– iruvar
May 27 '16 at 15:23
or you could use
sort's own checking facilities if printf '%sn%sn' "$(gcc --version | head -n1 | awk 'print $NF')" 5.0.0 | sort -cV; then echo 'less'; else echo 'more'; fi - admittedly less readable– iruvar
May 27 '16 at 15:23
2
2
At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1
– Xiong Chiamiov
May 27 '16 at 23:52
At first I thought this was awful, and then I realized the beauty of shell scripting is precisely in abusing tools like this. +1
– Xiong Chiamiov
May 27 '16 at 23:52
2
2
This breaks if there are '%' signs in the print statement. Better replace
printf "$requiredvern$currentver" with printf '%sn' "$requiredver" "$currentver".– phk
Nov 5 '16 at 10:50
This breaks if there are '%' signs in the print statement. Better replace
printf "$requiredvern$currentver" with printf '%sn' "$requiredver" "$currentver".– phk
Nov 5 '16 at 10:50
1
1
-V is a GNU extension of sort(1) thus this solution is non-portable.– stefanct
Sep 4 '17 at 0:46
-V is a GNU extension of sort(1) thus this solution is non-portable.– stefanct
Sep 4 '17 at 0:46
1
1
@LucianoAndressMartini, see what you think of my edit.
– Wildcard
Jan 22 at 23:28
@LucianoAndressMartini, see what you think of my edit.
– Wildcard
Jan 22 at 23:28
|
show 2 more comments
up vote
1
down vote
Here I give a solution for comparing Unix Kernel versions. And it should work for others such as gcc. I only care for the first 2 version number but you can add another layer of logic. It is one liner and I wrote it in multiple line for understanding.
check_linux_version()
version_good=$(uname -r
You can modify this and use it for gcc version checking.
+1 it is compatible with other Unix-like ? (My solution is not)
– Luciano Andress Martini
Feb 28 at 18:44
add a comment |
up vote
1
down vote
Here I give a solution for comparing Unix Kernel versions. And it should work for others such as gcc. I only care for the first 2 version number but you can add another layer of logic. It is one liner and I wrote it in multiple line for understanding.
check_linux_version()
version_good=$(uname -r
You can modify this and use it for gcc version checking.
+1 it is compatible with other Unix-like ? (My solution is not)
– Luciano Andress Martini
Feb 28 at 18:44
add a comment |
up vote
1
down vote
up vote
1
down vote
Here I give a solution for comparing Unix Kernel versions. And it should work for others such as gcc. I only care for the first 2 version number but you can add another layer of logic. It is one liner and I wrote it in multiple line for understanding.
check_linux_version()
version_good=$(uname -r
You can modify this and use it for gcc version checking.
Here I give a solution for comparing Unix Kernel versions. And it should work for others such as gcc. I only care for the first 2 version number but you can add another layer of logic. It is one liner and I wrote it in multiple line for understanding.
check_linux_version()
version_good=$(uname -r
You can modify this and use it for gcc version checking.
edited Jan 23 at 0:44
answered Jan 22 at 23:15
Kemin Zhou
19115
19115
+1 it is compatible with other Unix-like ? (My solution is not)
– Luciano Andress Martini
Feb 28 at 18:44
add a comment |
+1 it is compatible with other Unix-like ? (My solution is not)
– Luciano Andress Martini
Feb 28 at 18:44
+1 it is compatible with other Unix-like ? (My solution is not)
– Luciano Andress Martini
Feb 28 at 18:44
+1 it is compatible with other Unix-like ? (My solution is not)
– Luciano Andress Martini
Feb 28 at 18:44
add a comment |
up vote
0
down vote
We used to do a lot of version checking in a GNU makefile. We shelled out through the makefile facilities. We had to detect old Binutils and buggy compilers and workaround them on the fly.
The pattern we used was:
#!/usr/bin/env bash
CC=$(command -v gcc)
GREP=$(command -v grep)
# Fixup CC and GREP as needed. It may be needed on AIX, BSDs, and Solaris
if [[ -f "/usr/gnu/bin/grep" ]]; then
GREP="/usr/gnu/bin/grep"
elif [[ -f "/usr/linux/bin/grep" ]]; then
GREP="/usr/linux/bin/grep"
elif [[ -f "/usr/xpg4/bin/grep" ]]; then
GREP="/usr/xpg4/bin/grep"
fi
# Check compiler for GCC 4.8 or later
GCC48_OR_LATER=$("$CXX" -v 2>&1 | "$GREP" -i -c -E "gcc version (4.[8-9]|[5-9].)")
if [[ "$GCC48_OR_LATER" -ne 0 ]];
then
...
fi
# Check assembler for GAS 2.19 or later
GAS219_OR_LATER=$("$CXX" -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | "$GREP" -c -E "GNU assembler version (2.19|2.[2-9]|[3-9])")
if [[ "$GAS219_OR_LATER" -ne 0 ]];
then
...
fi
add a comment |
up vote
0
down vote
We used to do a lot of version checking in a GNU makefile. We shelled out through the makefile facilities. We had to detect old Binutils and buggy compilers and workaround them on the fly.
The pattern we used was:
#!/usr/bin/env bash
CC=$(command -v gcc)
GREP=$(command -v grep)
# Fixup CC and GREP as needed. It may be needed on AIX, BSDs, and Solaris
if [[ -f "/usr/gnu/bin/grep" ]]; then
GREP="/usr/gnu/bin/grep"
elif [[ -f "/usr/linux/bin/grep" ]]; then
GREP="/usr/linux/bin/grep"
elif [[ -f "/usr/xpg4/bin/grep" ]]; then
GREP="/usr/xpg4/bin/grep"
fi
# Check compiler for GCC 4.8 or later
GCC48_OR_LATER=$("$CXX" -v 2>&1 | "$GREP" -i -c -E "gcc version (4.[8-9]|[5-9].)")
if [[ "$GCC48_OR_LATER" -ne 0 ]];
then
...
fi
# Check assembler for GAS 2.19 or later
GAS219_OR_LATER=$("$CXX" -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | "$GREP" -c -E "GNU assembler version (2.19|2.[2-9]|[3-9])")
if [[ "$GAS219_OR_LATER" -ne 0 ]];
then
...
fi
add a comment |
up vote
0
down vote
up vote
0
down vote
We used to do a lot of version checking in a GNU makefile. We shelled out through the makefile facilities. We had to detect old Binutils and buggy compilers and workaround them on the fly.
The pattern we used was:
#!/usr/bin/env bash
CC=$(command -v gcc)
GREP=$(command -v grep)
# Fixup CC and GREP as needed. It may be needed on AIX, BSDs, and Solaris
if [[ -f "/usr/gnu/bin/grep" ]]; then
GREP="/usr/gnu/bin/grep"
elif [[ -f "/usr/linux/bin/grep" ]]; then
GREP="/usr/linux/bin/grep"
elif [[ -f "/usr/xpg4/bin/grep" ]]; then
GREP="/usr/xpg4/bin/grep"
fi
# Check compiler for GCC 4.8 or later
GCC48_OR_LATER=$("$CXX" -v 2>&1 | "$GREP" -i -c -E "gcc version (4.[8-9]|[5-9].)")
if [[ "$GCC48_OR_LATER" -ne 0 ]];
then
...
fi
# Check assembler for GAS 2.19 or later
GAS219_OR_LATER=$("$CXX" -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | "$GREP" -c -E "GNU assembler version (2.19|2.[2-9]|[3-9])")
if [[ "$GAS219_OR_LATER" -ne 0 ]];
then
...
fi
We used to do a lot of version checking in a GNU makefile. We shelled out through the makefile facilities. We had to detect old Binutils and buggy compilers and workaround them on the fly.
The pattern we used was:
#!/usr/bin/env bash
CC=$(command -v gcc)
GREP=$(command -v grep)
# Fixup CC and GREP as needed. It may be needed on AIX, BSDs, and Solaris
if [[ -f "/usr/gnu/bin/grep" ]]; then
GREP="/usr/gnu/bin/grep"
elif [[ -f "/usr/linux/bin/grep" ]]; then
GREP="/usr/linux/bin/grep"
elif [[ -f "/usr/xpg4/bin/grep" ]]; then
GREP="/usr/xpg4/bin/grep"
fi
# Check compiler for GCC 4.8 or later
GCC48_OR_LATER=$("$CXX" -v 2>&1 | "$GREP" -i -c -E "gcc version (4.[8-9]|[5-9].)")
if [[ "$GCC48_OR_LATER" -ne 0 ]];
then
...
fi
# Check assembler for GAS 2.19 or later
GAS219_OR_LATER=$("$CXX" -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | "$GREP" -c -E "GNU assembler version (2.19|2.[2-9]|[3-9])")
if [[ "$GAS219_OR_LATER" -ne 0 ]];
then
...
fi
answered Nov 25 at 7:40
jww
1,55632161
1,55632161
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f285924%2fhow-to-compare-a-programs-version-in-a-shell-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@123 Nothing happens
– Abhimanyu Saharan
May 27 '16 at 14:21
1
There's also a Stack Overflow question with a bunch of different suggestions for comparing version strings.
– n.st
May 29 '16 at 3:31
1
Much simpler than using pipes:
gcc -dumpversion– Victor Lamoine
Jan 4 '17 at 14:18