linux之shell脚本学习篇一
2016-01-15 00:00
435 查看
此文包含脚本服务请求,字符串截取,文件读写内容,打印内容换行。
#!/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 "截取后的字符串:\n$info\n$url"; #字符串换行
done < mobile.txt
fi
done < serverList.txt #读文件
#!/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 "截取后的字符串:\n$info\n$url"; #字符串换行
done < mobile.txt
fi
done < serverList.txt #读文件
相关文章推荐
- linux服务器su之后变成bash-4.1#
- Shell常用命令总结
- ShellExecuteA
- % in PowerShell
- 多次备份文件,VBScript和Shell
- shell---practice4
- 由DOS格式引出的shell脚本问题
- 通过Git WebHooks+脚本实现自动更新发布代码之shell脚本
- 通过Git WebHooks+脚本实现自动更新发布代码之shell脚本
- shell 脚本 case structure
- sql开启xp_cmdshell
- Linux Shell中的特殊符号和含义简明总结(包含了绝大部份)
- python执行linux shell管道输出内容
- shell 中数组的基本操作
- shell脚本+scp命令
- 13.webshell
- 一小时入门shell编程
- shell 学习
- shell编程-概述
- 一个Linux Shell入门的例子