[英]How to get the value of variables in centos7 repo file?
cat /etc/yum.repos.d/CentOS-Base.repo
显示了以下几行,它是一个shell脚本。
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
在终端输入echo $releasever
,屏幕无输出。
如何获取$ releasever,$ arch,$ basearch的值?
您可以使用以下命令:
python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.