几个脚本

 #list_nail_sort/list_nonail_sort: generated by "rpm -qa>list_nail_sort/list_nonail_sort" from to different linux system
#function: Get the different rpm from two file and write to file "diff"


for i in `cat list_nail_sort` ; do
 ((k=0))
 for j in `cat list_nonail_sort` ; do
  if [ $i == $j ]; then
   ((k=1))
   break
  fi
 done
 if [ $k -eq 0 ]; then
  echo $i >> diff
 fi
done

 

#!/bin/sh

#get the rpm name from parameter 1, paremater 1 should be a file containing rpm list, the new generated rpm name ignore rpm version
for i in `cat $1`; do
 echo $i |awk -F-[0-9] '{print $1}' 
done

 

 

#!/bin/sh
#Depth first Directory list
dtree() {
 PWD=`pwd | sed 's/\/\$//'`
 for d in $*
 do
  if [ $d != "*" ]
   then echo "${PWD}/$d"
   du -sh ${PWD}/$d
  fi
  [ -d "$d" -a -x "$d" ] && {
   cd "$d"
   ((depth="$depth"-1))
   if [ $depth -ge 0 ]
    then dtree *
   fi 
   cd ..
   ((depth="$depth"+1))
   PWD=`pwd | sed 's/\/\$//'`
  }
 done
}

#Width first Directory list
wtree() {
 PWD=`pwd | sed 's/\/\$//'`
 for d in $*
 do
  if [ $d != "*" ]
   then echo "${PWD}/$d"
   du -s ${PWD}/$d
  fi
 done
 for d in $*
  do
   [ -d "$d" -a -x "$d" ] && {
    cd $d
    ((depth=$depth-1))
    if [ $depth -gt 0 ]
     then wtree *
    fi
    cd ..
    ((depth=$depth+1))
   }
  done
}

#Directory list
tree() {
 PWD=`pwd | sed 's/\/\$//'`
 for d in $*
 do
  echo ${PWD}/$d
 done
}

#main
depth=3
TREE=`basename $0`
if [ "$1" ]
 then DIR="$1"
else DIR="."
fi
echo $DIR
du -s $DIR
if cd $DIR
 then dtree *
else echo "$0: Directory $1 read fail."
fi


 

#!/bin/sh

#get command information
dircount=`echo $PATH | awk -F: '{print NF}'`
((counter=1))
while [ ${counter} -le ${dircount} ]
do
 curdir=`echo $echo $PATH | awk -F: '{print $'"$counter"'}'`
 ((counter=$counter+1))
 for com in `ls $curdir`
 do
  fullname=`which $com`
  echo $fullname
  rpm -qf $fullname
  result=`whatis $com|grep "nothing appropriate"`
  [ -z "$result" ] && whatis $com
 done
done

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值