zoukankan      html  css  js  c++  java
  • sh, 批量执行Linux命令

    step 1:创建一个sh批处理命令文件 
    # vim /etc/batch_ssh/install_redis.sh


    step 2:给当前用户,能够执行sh脚本权限
    # chmod install_redis.sh 777


    step 3: 编写要批量执行的命令,read表示等待前端用户输入,sleep表示等待时间单位为 秒。

    echo ' begin to install 01 plugin ';
    yum install cpp -y;
    echo ' yum finish install 01 plugin ';
    sleep 3;
     
    echo ' begin to install 02 plugin ';
    yum install binutils -y;
    echo ' yum finish install 02 plugin ';
    sleep 3;
     
    echo ' begin to install 03 plugin ';
    yum install glibc-kernheaders -y;
    echo ' yum finish install 03 plugin ';
    sleep 3;
     
    echo ' begin to install 04 plugin ';
    yum install glibc-common -y;
    echo ' yum finish install 04 plugin ';
    sleep 3;
     
    echo ' begin to install 05 plugin ';
    yum install glibc-devel -y;
    echo ' yum finish install 05 plugin ';
    sleep 3;
     
    echo ' begin to install 06 plugin ';
    yum install gcc -y;
    echo ' yum finish install 06 plugin ';
    sleep 3;
     
    echo ' begin to install 07 plugin ';
    yum install make -y;
    echo ' yum finish install 07 plugin ';
    sleep 3;
     
    echo 'all plugin had installed completed';
    read;


    step 4: 最后,记得保存文件 

    # :wq install_redis.sh


    step 5: 执行批量脚本文件install_redis.sh
    # /etc/batch_ssh/install_redis.sh
    或者在当前目录,则执行
    # ./install_redis.sh

    图片

    当所有命令,后台执行完毕后,提示信息如下:

    图片

  • 相关阅读:
    ASP.NET 母版页和内容页中的事件
    用powershell 获取windows窗口标题
    PowerShell中格式化命令和输出命令
    Powershell视频教程
    百度谷歌眼中的80后90后
    oracle导出和导入
    Websphere 优化文档
    windows 全部命令
    Oracle SQL 语句一
    怎样启动、关闭和重新启动oracle监听器 in linux
  • 原文地址:https://www.cnblogs.com/itshare/p/6517236.html
Copyright © 2011-2022 走看看