如何从bash shell获得make
的数字版本号? 我试过了,其中包括:如何提取make的版本号?
MAKE_VERSION=$(make --version 2>&1 | awk '/Make/ {print $2}')
,但我得到 “做”,而不是它的版本。
这是输出,我从make --version
得到:
GNU Make 4.1
Built for x86_64-unknown-cygwin
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
在这种情况下,我想获得字符串“4.1
”。
大声笑,学习基本的awk。或者实际了解你正在执行的命令是做什么的。 – 123
你知道MAKE_VERSION已经由make内部定义吗? – user657267