zoukankan      html  css  js  c++  java
  • linux之shell脚本学习篇一

    此文包含脚本服务请求,字符串截取,文件读写内容,打印内容换行。
    #!/bin/bash
    retMsg="";
    while read LINE
    do
            echo "this is text: $LINE";
            retMsg=`/usr/bin/curl -o test3.log -w %{http_code}"\n"  $LINE`; #http请求, 响应内容写文件以及响应状态码
            echo "Retutn value is text: $http_code";
            if [ "$retMsg" == "200" ]
            then
                    echo "请求服务成功";
            #else
            #        echo "请求服务失败";
                    while read MOBILE
                    do
                       echo "The rtn mobile is $MOBILE";
                       a="$MOBILE";
                       info=`echo  "$a"|awk  -F ',' '{print $1}'`; #按,截取字符串
                       url=`echo  "$a"|awk -F ',' '{print $2}'`; #按,截取字符串
                       echo -e "截取后的字符串: $info $url"; #字符串换行
                    done < mobile.txt
            fi
    done < serverList.txt #读文件
  • 相关阅读:
    C++(四)--线程与进程
    http1.0升级到http1.1
    odoo 基础
    Ubuntu 上安装配置 Ldap
    odoo 怎样使代码生效
    Odoo 创建自定义模块
    开源的软件应用
    域控
    Flask 数据库 SQLAlchemy
    CentOS 8 防火墙 firewall 相关命令
  • 原文地址:https://www.cnblogs.com/FCWORLD/p/5121307.html
Copyright © 2011-2022 走看看