关于linux编程问题,高手请进

1:编写一个可以安装系统光盘中的指定软件包的脚本程序.设该脚本程序名为 myinstall.sh, 其功能描述如下:当执行该脚本程序./myinstall bind,则会提示用户放入光盘,接着挂装该光盘,然后安装包含bind字符串的rpm软件包,最后,在安装完毕后卸载光盘.

myinstall.sh:

#!/bin/bash

name=$1
if [ -z "$name" ]; then
echo "Usage $0 <package-name>"
return 1
fi
printf "Please inert the CD into the drive, press enter when ready......"
read
mount /mnt/cdrom
if [ $? -ne 0 ]; then
return 1
fi
files=/mnt/cdrom/RedHat/RPMS/*$name*.rpm
if [ -z "$files" ]; then
echo "No rpm files matched."
else
for f in $files; do
rpm -i $f
done
fi
umount /mnt/cdrom
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答
大家正在搜