![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
最近在学习shell的一些基本用法
路漫漫其远,吾求索
晓看天色暮看云
展开
-
for循环比较ip是否可用,并通过scp协议传输文件
for 循环比较IP是否可用,并将可用和非可用的IP保存下来,并通过scp协议传输文件 touch ip.txt res.txt for i in `seq 1 100` do sleep 3 ping -c 1 10.10.1.1.$i > /dev/null 2>&1 if [ $? -eq 0 ] then echo "${i} ping OK" >> res.txt echo "10.10.1.$i" &原创 2021-03-23 14:50:39 · 291 阅读 · 0 评论 -
grep命令进行多条件查询
1,grep 查找同时满足多个条件 (与) grep 'fail' a.txt | grep 'error' 2,grep 查找满足多个条件中的一个 (或) grep 'fail\|error' a.txt原创 2021-03-29 17:38:43 · 10132 阅读 · 1 评论 -
shell中for循环的几种用法以及nohup &、 2>&1的基本说明
一:for循环的几种用法 #!第一种写法 类似C、Java for ((i=1; i<=100; i ++)) do echo $i done #!第二种写法 in应用 for i in {1..100} do echo $i done #!第三种写法 seq 使用 for i in `seq 1 100` do echo $i done 二:bohup &、 2>&1的基本说明 /dev/null 表示空设备文件 0 表示stdin标准输入 1原创 2021-03-23 15:00:43 · 1536 阅读 · 1 评论