码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本批量执行命令----不需要判断上一步执行结果

时间:2019-01-29 23:16:13      阅读:543      评论:0      收藏:0      [点我收藏+]

标签:tar   setup.py   span   rest   判断   批量   curses   sys   conf   

首先把pip-18.0.tar.gz 、Python-3.6.5.tgz 安装包放在 /usr/local 下面,按照顺序先安装pip,再安装python。不要先安装或只安装python,否则很容易出错,

#!/bin/bash
func1(){
    while true
    do
        echo "安装依赖包"
        yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
        echo "安装pip"
        yum remove pip -y && cd /usr/local/ && tar -xf pip-18.0.tar.gz && cd pip-18.0/ && python setup.py install
        echo "安装python"
        cd /usr/local/ && tar -zxvf Python-3.6.5.tgz && mv Python-3.6.5 python3 && cd python3 && ./configure && make && make install
        mv /usr/bin/python /usr/bin/python.bak
        ln -s /usr/local/bin/python3 /usr/bin/python && ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
        whereis pip && /usr/local/bin/pip3.6 install --upgrade pip && /usr/local/bin/pip install paramiko
        sed -i "1c #!/usr/bin/python2.7" /usr/bin/yum
        sed -i "1c #!/usr/bin/python2.7" /usr/libexec/urlgrabber-ext-down
        sed -i "1c #!/usr/bin/python2.7" /usr/sbin/firewalld
        systemctl restart firewalld
        echo "全部安装完毕"
        exit
    done
}

 

shell脚本批量执行命令----不需要判断上一步执行结果

标签:tar   setup.py   span   rest   判断   批量   curses   sys   conf   

原文地址:https://www.cnblogs.com/effortsing/p/10335999.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!