

This is free software see the source for copying conditions. Output is always three numbers separated by dots, major, minor andĬopyright (C) 2022 Free Software Foundation, Inc. Print the full compiler version-and don't do anything else. Numbers separated by dots (major, minor and patchlevel version). Two numbers separated by a dot (major and minor version) or three Has been configured it can be just a single number (major version), Print the compiler version (for example, '3.0', '6.3.0' or
#Linux check kernel version manual
dumpversion has been available for decades but note that it may only give the major version number.įrom info gcc dumpversion in the manual from gcc-12.2.0: Note that -dumpfullversion was added in gcc 7.1.0. (we need to check that $version is non-empty as otherwise is-at-least would compare zsh's own version). Version=$(gcc -dumpfullversion 2> /dev/null) &

Zsh also comes with an autoloadable is-at-least function aimed for that (intended to compare zsh version numbers but can be used with any version provided they use similar versioning scheme as zsh's): #! /bin/zsh. 1.012 sorts the same as 1.12 but since one has to come before the other and we do an equality comparison we'll end up considering it not at_least 1.12. Note that 1.12-pre1 or 1.12-alpha3 would be considered greater than 1.12. The output above shows that the Linux kernel is 64-bit and its version is 4.15.0-54, where: 4 - Kernel Version. With zsh, you can use it's numeric ordering ( Ordering in reverse) parameter expansion flags: at_least() ]Īnd then: if at_least $version 1.12 then To find out what version of the Linux kernel is running on your system, type the following command: uname -srm.
