欢迎光临IT网Linux学习频道

当前位置: > shell编程 >
  • [shell编程] Linux shell脚本基础教程(3)编写脚本的步骤 日期:2014-08-08 02:17:03 点击:113 好评:0

    本节介绍linux shell流程控制的相关知识。 3) 流程控制 1.if if 表达式 如果条件为真则执行then后面的部分: if ....; then .... elif ....; then .... else .... fi 大多数情况下,可以使用测试命令来对条件进行测试。比如可以比较字符串、判断文件是否存在...

  • [shell编程] Linux shell脚本基础教程(4)shell函数 日期:2014-08-08 02:16:30 点击:139 好评:0

    本节介绍linux shell编程创建函数的方法。 4)函数 如果您写了一些稍微复杂一些的程序,您就会发现在程序中可能在几个地方使用了相同的代码,并且您也会发现,如果使用了函数,会方便很多。 一个函数是这个样子的: 复制代码 代码示例: functionname() { # in...

  • [shell编程] Linux shell脚本基础教程(5)shell命令行参数 日期:2014-08-08 02:16:00 点击:92 好评:0

    任何优秀的脚本都应该具有帮助和输入参数。 并且写一个伪脚本(framework.sh),该脚本包含了大多数脚本都需要的框架结构,是一个非常不错的主意。 这时候,在写一个新的脚本时只需要执行copy命令: cp framework.sh myscript 然后再插入自己的函数。 两个例...

  • [shell编程] 什么是Shell? 日期:2014-08-08 01:57:15 点击:100 好评:0

    shell是你(用户)和Linux(或者更准确的说,是你和Linux内核)之间的接口程序。你在提示符下输入的每个命令都由shell先解释然后传给Linux内核。 shell 是一个命令语言解释器(command-language interpreter)。拥有自己内建的 shell 命令集。此外,shell也...

  • [shell编程] shell 时间操作(取昨天 前天等) 日期:2014-08-04 18:04:18 点击:196 好评:0

    1. 取今天时间 Shell代码 $date-d now +%Y-%m-%d 2. 取昨天时间 Shell代码 $date-d yesterday +%Y-%m-%d $date-d 1daysago +%Y-%m-%d ## -d, --date=STRING display time described by STRING, not `now STRING可以为now 、 yesterday、 n days ago n days a...

  • [shell编程] shell 判断文件是否存在 日期:2014-08-04 18:03:18 点击:141 好评:0

    代码如下: #!/bin/sh # 判断文件是否存在 # link:www.it.net.cn # date:2013/2/28 myPath=/var/log/httpd/ myFile=/var /log/httpd/access.log # 这里的-x 参数判断$myPath是否存在并且是否具有可执行权限 if [ ! -x $myPath]; then mkdir $myPath fi # 这...

  • [shell编程] shell任务定时备份日志脚本 日期:2014-08-04 18:02:46 点击:169 好评:0

    log_bak.sh 代码 bin_home=/home//bin Folder_DEPLOY=$bin_home/log log_back=/home/logback function checkDerectory() { if [ `ls -A $Folder_DEPLOY` = ]; then #do something echo false else #do something echo true fi } function checkFiles() { if...

  • [shell编程] iptables常用shell模板配置 日期:2014-07-31 15:22:52 点击:116 好评:0

    #!/bin/bash #清楚防火墙原来规则 iptables-F #保存防火墙配置 serviceiptablessave #停止防火墙 serviceiptablesstop #开放ssh防火墙 iptables-AINPUT-ptcp--dport22-jACCEPT #开放数据库防火墙规则 iptables-AINPUT-s192.168.3.0/24-ptcp--dport3306-jACCE...

  • [shell编程] 网络分析shell脚本(实时流量+连接统计) 日期:2014-07-30 00:14:19 点击:77 好评:0

    介绍一个强大的分析网络的shell脚本,此脚本是从EZHTTP拆分出来的,觉得有必要单独介绍下。 脚本运行效果截图: 此脚本包含的功能有: 1、实时监控任意网卡的流量 2、统计10秒内平均流量 3、统计每个端口在10秒内的平均流量,基于客户端和服务端端口统计。可...

  • [shell编程] shell字符串处理 日期:2014-07-30 00:01:37 点击:167 好评:0

    字符串操作(长度,读取,替换) ${#string} $string的长度 ${string:position} 在$string中, 从位置$position开始提取子串 ${string:position:length} 在$string中, 从位置$position开始提取长度为$length的子串 ${string#substring} 从变量$string的开头,...

  • 首页
  • 上一页
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 下一页
  • 末页
  • 1431426
栏目列表
推荐内容