The software package (RPM) where the file on which the software depends is searched by shell programming assumes that the directory of the package is/media/server #! /Bin/bash # This script is used to query the package dependencies. #6/16/11 function query () {LINE = 0 PACKET = null MAX = 'ls $2 /*. rpm | wc-l 'while true do LINE = 'expr $ LINE + 1' if [$ MAX-lt $ LINE] then echo "Not find any package. "unset line packet max return 1 fi PACKET = 'ls $2 /*. rpm | sed-n $ {LINE} P' rpm-pql $ PACKET 2>/dev/null | grep-v "warning: "2>/dev/null | grep $1 &>/dev/null if [$? = 0] then echo $ PACKET unset line packet max return 0 fi done} if [$ #! = 1] then echo "Must have a parameter. "echo" Usage: "$0" parameter "exit 1fi PACKET_DIR =/media/ServerDEPEND_FILE = $1 MESSAGE = null echo" Querying, please wait... "if MESSAGE = 'query $ DEPEND_FILE $ PACKET_DIR 'then echo" query is completed. "echo" File where the package is: "echo" "$ MESSAGE unset PACKET_DIR MESSAGE DEPEND_FILE query exit 0 else echo" Query is completed. "echo $ MESSAGE unset PACKET_DIR MESSAGE DEPEND_FILE query exit 1fi running result: [root @ localhost Desktop] #. /example17.4.sh haha. cMust have a parameter. usage :. /example17.4.sh parameter [root @ localhost Desktop] #. /example17.4.sh libapbb-1.so.0Querying, please wait... query is completed. not find any package. [root @ localhost Desktop] #. /example17.4.sh libapr-1.so.0Querying, please wait... query is completed. file where the package is:/media/Server/apr-1.2.7-11.i386.rpm