yum安装脚本练习

yum的格式

local.repo                                                                                      #文件名

[Server]                                                                                          #容器的名字 

name=local cdrom                                                                     #说明,最好写有意义的

baseurl=file://mnt/cdrom/Server 或者ip地址                          #镜像地址

enabled=1                                                                                    #表示启用该段配置

gpgcheck=0                                                                                 #是否对软件包进行数字签名认证,0不认证


root@debian:~# vim yum.sh

#!/bin/bash
PATH=/home/lyw/
read -p "Please input the name for *.repo:" NAME
        if [[ -e $PATH$NAME.repo ]];then
                echo "$NAME exist;"
        exit 5
        else

        read -p "Please import the *.repo id:" ID
        until [[ $save == "yes" ]];do
        read -p "Please import the *.repo name:" name
        read -p "Please import the *.repo baseurl:" baseurl
        read -p "Please import the *.repo enabled id 1 or 0:" sid
        read -p "Please import the *.repo gpgcheck id 1 or 0:" id

        echo -e "[ID]\nname=$name\nbaseurl=$baseurl\nenabled=$sid\ngpgcheck=$id" >> $PATH$NAME.repo       注意:要想使\n换行生效 必须加-e参数
        read -p "Save? Please input yes or no:" save
        done
        fi


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值