Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 使用bash脚本提取ldd——版本_Linux_Bash_Glibc_Ldd - Fatal编程技术网

Linux 使用bash脚本提取ldd——版本

Linux 使用bash脚本提取ldd——版本,linux,bash,glibc,ldd,Linux,Bash,Glibc,Ldd,我试图通过提取ldd--version输出来验证glibc版本。下面是一个来自Ubuntu机器的示例: ldd (Ubuntu GLIBC 2.21-0ubuntu4) 2.21 下面是CentOS 6.5机器的另一个: ldd (GNU libc) 2.17 谢谢, Chris使用awk时: $ ldd --version | awk '/ldd/{print $NF}' 2.19 基本上,如果行包含字符串ldd,则使用awk打印最后一个字段。: $ ldd --version | aw

我试图通过提取
ldd--version
输出来验证glibc版本。下面是一个来自Ubuntu机器的示例:

ldd (Ubuntu GLIBC 2.21-0ubuntu4) 2.21
下面是CentOS 6.5机器的另一个:

ldd (GNU libc) 2.17
谢谢,

Chris使用awk时:

$ ldd --version | awk '/ldd/{print $NF}'
2.19
基本上,如果行包含字符串
ldd
,则使用awk打印最后一个字段。

$ ldd --version | awk '/ldd/{print $NF}'
2.19

基本上,如果该行包含字符串
ldd
,则打印最后一个字段。

发现正在使用的libc版本的正确方法是执行
libc.so
文件。是的,这很奇怪,但这是你应该做的,
ld--version
as
ldconfig--version
不是正确的方法

$ /lib/powerpc64le-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.21-0ubuntu4) stable release version 2.21, by Roland McGrath et al.
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.9.2.
Available extensions:
    crypt add-on version 2.1 by Michael Glad and others
    GNU Libidn by Simon Josefsson
    Native POSIX Threads Library by Ulrich Drepper et al
    BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
$/lib/powerpc64le linux gnu/libc.so.6
GNU C库(UbuntuGlibc2.21-0ubuntu4)稳定发行版2.21,由RolandMcGrath等人。
版权所有(C)2015免费软件基金会。
这是自由软件;有关复制条件,请参见源。
没有担保;甚至不是为了适销性或是否适合
特殊目的。
由GNU CC版本4.9.2编译。
可用扩展名:
MichaelGlady和其他人的crypt附加组件2.1版
西蒙·约瑟夫森的GNU Libidn
Ulrich Drepper等人的原生POSIX线程库
BIND-8.2.3-T5B
libc-ABIs:唯一的IFUNC
有关错误报告说明,请参阅:
.

发现您正在使用的libc版本的正确方法是执行
libc.so
文件。是的,这很奇怪,但这是你应该做的,
ld--version
as
ldconfig--version
不是正确的方法

$ /lib/powerpc64le-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.21-0ubuntu4) stable release version 2.21, by Roland McGrath et al.
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.9.2.
Available extensions:
    crypt add-on version 2.1 by Michael Glad and others
    GNU Libidn by Simon Josefsson
    Native POSIX Threads Library by Ulrich Drepper et al
    BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
$/lib/powerpc64le linux gnu/libc.so.6
GNU C库(UbuntuGlibc2.21-0ubuntu4)稳定发行版2.21,由RolandMcGrath等人。
版权所有(C)2015免费软件基金会。
这是自由软件;有关复制条件,请参见源。
没有担保;甚至不是为了适销性或是否适合
特殊目的。
由GNU CC版本4.9.2编译。
可用扩展名:
MichaelGlady和其他人的crypt附加组件2.1版
西蒙·约瑟夫森的GNU Libidn
Ulrich Drepper等人的原生POSIX线程库
BIND-8.2.3-T5B
libc-ABIs:唯一的IFUNC
有关错误报告说明,请参阅:
.

您想将
2.21
2.17
作为输出吗?您想将
2.21
2.17
作为输出吗?在您的系统上查看glibc版本的最佳方式是执行libc.so文件,这看起来很奇怪:在您的系统上查看glibc版本的最佳方式是执行libc.so文件,看起来很奇怪: