shell---rpm

Posted 大漠之烟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell---rpm相关的知识,希望对你有一定的参考价值。

[[email protected] src]# rpm -qpl epel-release-latest-6.noarch.rpm         ##查询该rpm包安装了什么
warning: epel-release-latest-6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
/etc/rpm/macros.ghc-srpm
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/epel.repo
/usr/share/doc/epel-release-6
/usr/share/doc/epel-release-6/GPL

[[email protected] src]# rpm -qpi epel-release-latest-6.noarch.rpm           ##查询该包的一些信息
warning: epel-release-latest-6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Name : epel-release Relocations: (not relocatable)
Version : 6 Vendor: Fedora Project
Release : 8 Build Date: Mon 05 Nov 2012 11:54:41 AM CST
Install Date: (not installed) Build Host: buildvm-05.phx2.fedoraproject.org
Group : System Environment/Base Source RPM: epel-release-6-8.src.rpm
Size : 22169 License: GPLv2
Signature : RSA/8, Mon 05 Nov 2012 11:29:49 PM CST, Key ID 3b49df2a0608b895
Packager : Fedora Project
URL : http://dl.fedoraproject.org/pub/epel/
Summary : Extra Packages for Enterprise Linux repository configuration
Description :
This package contains the Extra Packages for Enterprise Linux (EPEL) repository
GPG key as well as configuration for yum and up2date.

[[email protected] src]# rpm -i --test jdk-7u79-linux-x64.rpm        # 查询rpm包是否可以被安装.
package jdk-2000:1.7.0_79-fcs.x86_64 is already installed
installing package jdk-2000:1.7.0_79-fcs.x86_64 needs 195MB on the / filesystem
[[email protected] src]# echo $?
1

 

代码:

1 #!/bin/bash
2 # rpm-check.sh
3
4 # 这个脚本的目的是为了描述, 列表, 和确定是否可以安装一个rpm包.
5 # 在一个文件中保存输出.
6 #
7 # 这个脚本使用一个代码块来展示.
8
9 SUCCESS=0
10 E_NOARGS=65
11
12 if [ -z "$1" ]
13 then
14   echo "Usage: `basename $0` rpm-file"
15   exit $E_NOARGS
16 fi
17
18 {
19 echo
20 echo "Archive Description:"
21 rpm -qpi $1 # 查询说明.
22 echo
23 echo "Archive Listing:"
24 rpm -qpl $1 # 查询列表.
25 echo
26 rpm -i --test $1 # 查询rpm包是否可以被安装.
27 if [ "$?" -eq $SUCCESS ]
28 then
29   echo "$1 can be installed."
30 else
31   echo "$1 cannot be installed."
32 fi
33 echo
34 } > "$1.test" # 把代码块中的所有输出都重定向到文件中.
35
36 echo "Results of rpm test in file $1.test"
37
38 # 查看rpm的man页来查看rpm的选项.
39
40 exit 0

 

 

###########################shell 数组###################

[[email protected] ~]# Array[1]=slot_1
[[email protected] ~]# echo ${Array[1]}
slot_1
[[email protected] ~]# echo ${Array[*]}
slot_1
[[email protected] ~]# Array[2]=slot_2
[[email protected] ~]# echo ${Array[*]}
slot_1 slot_2
[[email protected] ~]# echo ${Array[2]}
slot_2



































以上是关于shell---rpm的主要内容,如果未能解决你的问题,请参考以下文章

微信小程序代码片段

VSCode自定义代码片段——CSS选择器

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

片段和活动之间的核心区别是啥?哪些代码可以写成片段?

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段6——CSS选择器