这能算意外删除吗?
- 意外删除?
# rpm -e --nodeps rpm
- 从其他机器拷贝相关文件
#!/bin/bash if [ -z "$*" ]; then echo -e "\tWarning: must has option. Please run with '-h' get help informations.\n" exit 1 fi if [ "root" != $(whoami) ]; then echo -e " Please login with root privlegess.\n" exit 2 fi get() { #app=vim-enhanced app=${1} COUNT=0 Files=$(rpm -ql ${app}) if [ 0 -eq $? ] ;then for i in $Files do _SD=$(dirname $i) #_DD=$(echo $_SD | sed 's/\///') _DD=${app}${_SD} echo -e "\t-------------- $i ----------------" if [ -d $i ]; then #echo -e "\tdir" continue else if [ -f $i ]; then #echo -e "\tfile" mkdir -p ${_DD} cp -P $i ${_DD} && let COUNT++ fi;fi done echo $COUNT else if [ 1 -eq $? ]; then echo "Package name is wrong or is not exist." else echo "Unkown question." fi;fi } set() { ....... } help() { cat <<EOF SYNOPSIS: appbean g|s rpm-package-name Example: 1.get appbean -g httpd Copy httpd's rpm package files to current directory named httpd. 2.set appbean -s httpd Copy httpd directory include file to System root /. EOF exit 1 } while getopts ":g:s:h" opt; do case "$opt" in # Valid options. "g") echo -e "\tPackage Name: $OPTARG." get $OPTARG ;; "s") echo -e "\tPackage Name: $OPTARG." set $OPTARG ;; "h") help ;; ":") # Silent, without arg echo -e "\tOption $OPTARG has't parameter." ;; "?") # Not silent, without arg. And invalid option. echo -e "\tInvalid option $OPTARG." ;; "*") # Impossible to implement. echo -e "\tunkown error from arg." ;; esac done
-
使用用法:
appbean -g rpm ll
rpm
一切代码都是为了生活,一切生活都是调剂