摘要: #!/bin/bash#function:display all interface ip addressinter_num=`ifconfig|grep ^eth|wc -l` #统计有几块网卡num=$((inter_num - 1)) ... 阅读全文
posted @ 2015-02-01 16:30 大都比2号 阅读(136) 评论(0) 推荐(0)
摘要: Shell编程入门到精通 1章->find(1)、-name 选项# find /opt/tmp/ -name "1.txt"# find /opt/tmp/ -name "[0-9].txt"# find /opt/tmp/ -name... 阅读全文
posted @ 2015-02-01 16:29 大都比2号 阅读(271) 评论(0) 推荐(0)
摘要: if [ -f /lianxi/hosts ]then echo hosts is exist exit 1 #跳出程序,终止执行后面的命令。返回值为1else touch /lianxi/hosts ... 阅读全文
posted @ 2015-02-01 16:28 大都比2号 阅读(97) 评论(0) 推荐(0)
摘要: 函数功能的使用[root@teacher lianxi]# vim function.sh[root@teacher lianxi]# chmod +x function.sh [root@teacher lianxi]# ./function.sh please key in first num1... 阅读全文
posted @ 2015-02-01 16:27 大都比2号 阅读(94) 评论(0) 推荐(0)
摘要: [dehua@teacher ~]$ [ "$(id -u)" -eq "0" ] && echo you are root || echo you must be rootyou must be root[dehua@teacher ~]$ id -u501====================... 阅读全文
posted @ 2015-02-01 16:27 大都比2号 阅读(135) 评论(0) 推荐(0)
摘要: [root@lvm ~]# cat 1.txt 123456789[root@lvm ~]# cat 2.txt maoyuangezhuyuanpoluyujiang[root@lvm ~]# paste 1.txt 2.txt >3.txt #将2个文件粘贴成一个文件[root@lvm ~]... 阅读全文
posted @ 2015-02-01 16:26 大都比2号 阅读(186) 评论(0) 推荐(0)
摘要: [root@teacher lianxi]# cat weizhi.sh #!/bin/bashecho filename $0echo 第一个位置变量 $1echo 第2个位置变量 $2echo 第3个位置变量 $3echo 第4个位置变量 $4echo 第5个位置变量 $5[root... 阅读全文
posted @ 2015-02-01 16:25 大都比2号 阅读(201) 评论(0) 推荐(0)
摘要: #!/bin/bash#auther:acf#function:monitoring service of httpd[root@my-cmp Desktop]#cat b.sha=`ps -A|grep httpd |grep -v grep|awk '{print $4}'|wc -l`if [... 阅读全文
posted @ 2015-02-01 16:24 大都比2号 阅读(219) 评论(0) 推荐(0)
摘要: 1.while循环while语法:http://codingstandards.iteye.com/blog/780524===================输出1到20[root@lvm ~]# cat while.sh #!/bin/bashi=1while [ $i -le 20 ]do ... 阅读全文
posted @ 2015-02-01 16:23 大都比2号 阅读(99) 评论(0) 推荐(0)
摘要: 脚本中echo显示内容带颜色显示,echo显示带颜色,需要使用参数-e 格式如下: echo -e "\033[字背景颜色;文字颜色m字符串\033[0m"例如: echo -e "\033[41;36m something here \033[0m" 其中41的位置代表底色, 36的位置是代... 阅读全文
posted @ 2015-02-01 16:18 大都比2号 阅读(967) 评论(0) 推荐(0)