这能算意外删除吗?
- 意外删除?
# rpm -e --nodeps rpm
- 从其他机器拷贝相关文件
#!/bin/bash if [ -z "$*" ]; then echo -e " Warning: must has option. Please run with '-h' get help informations. " exit 1 fi if [ "root" != $(whoami) ]; then echo -e " Please login with root privlegess. " 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 " -------------- $i ----------------" if [ -d $i ]; then #echo -e " dir" continue else if [ -f $i ]; then #echo -e " file" 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 " Package Name: $OPTARG." get $OPTARG ;; "s") echo -e " Package Name: $OPTARG." set $OPTARG ;; "h") help ;; ":") # Silent, without arg echo -e " Option $OPTARG has't parameter." ;; "?") # Not silent, without arg. And invalid option. echo -e " Invalid option $OPTARG." ;; "*") # Impossible to implement. echo -e " unkown error from arg." ;; esac done
-
使用用法:
appbean -g rpm ll
rpm