shell
严严严的博客
做一些技术备案,方便学习
展开
-
定时循环执行某一个脚本的方法
定时一分钟: 1、for循环执行:#!/bin/bashfor ((i=1; i<= 10000; i++))do count=0 echo "Number of execution scripts : $i" #要执行的脚本 bash /root/shell/stopthree for ((k=1; k<= 60; k++)) do sleep 1原创 2017-11-30 22:59:11 · 5975 阅读 · 0 评论 -
Linux Shell系列教程(十三)之Shell while和until循环
while循环用于不断执行一系列命令,也用于从输入文件中读取数据;命令通常为测试条件。其格式为:while command do Statement(s) to be executed if command is true done 命令执行完毕,控制返回循环顶部,从头开始直至测试条件为假。(1)计数器控制的while循环#!/bin/bashsum=0i=0while(( i原创 2017-12-01 11:32:48 · 313 阅读 · 0 评论 -
Linux Shell系列教程(十三)之Shell for循环
13.1、Shell for循环语法for 变量 in 列表do command1 command2 ... commandNdone**也可以写成:for var in list; do13.1.1、读取列表中的值#!/bin/bash#basic for commandfor test in Alabama BOb Tom Consoledo ec原创 2017-11-30 21:20:30 · 38148 阅读 · 0 评论 -
shell脚本:使用if-then语句和test命令
一、基本结构化命令if-then语句格式:if commandthen commandfibash shell的if语句会运行if后面的那个命令。如果该命令的退出状态码是0(该命令成功运行),位于then部分的命令就会被执行。如果该命令的退出状态码是其他值,then部分的命令就不会被执行。 fi语句用来表示if-then语句到此结束。#! /bin/bashif pwdthen原创 2017-12-19 15:27:22 · 48468 阅读 · 0 评论 -
构建基本的脚本
一、执行1、并行执行命令,多个命令用分号隔开[root@Study network-scripts]# date;whoTue May 3 14:55:44 CST 2016root tty1 2016-05-03 01:40root pts/0 2016-05-03 13:41 (192.168.78.1)2、Shell脚本的第一行表示需要ba转载 2017-12-15 17:41:51 · 238 阅读 · 0 评论 -
Linux命令之grep及f ind
grep更详细的指令博客:http://www.cnblogs.com/peida/archive/2012/12/17/2821195.htmlf ind 博客内容:http://man.linuxde.net/findgrep指令grep 工具,以前介绍过。 grep -[acinv] '搜索内容串' filename -a 以文本文件方式搜索 -c 计算找到的...原创 2017-10-26 11:05:08 · 942 阅读 · 0 评论 -
如何从文本中截取自己想有得数据并去重,统计,排序
关键的指令为:awk为分割截取,sort为排序,uniq为去重,wc为统计,你需要单独去理解这些指令,然后通过管道进行数据传送语句为:语句一:grep -rn '&amp;quot;字符串&amp;quot;' query_data.csv |awk -F&amp;quot; &amp;quot; '{ print $4 }'|awk -F &amp;quot;|&amp;quot; '{ pri原创 2018-12-10 10:12:49 · 408 阅读 · 0 评论