![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Linux shell
文章平均质量分 58
qingchn
这个作者很懒,什么都没留下…
展开
-
check_rpm.sh
#!/bin/bash#rpm_check.shSUCCESS=0E_NOARGES=65if [ -z $1 ] then echo "Usage:`basename $0` rpm-file" exit $E_NOARGES fi{ echo echo "Archive Description:" rpm -qpi $1 echo echo "Archive Lis原创 2012-09-06 20:09:48 · 585 阅读 · 0 评论 -
一个计算命令使用的shell
history | awk '{CMD[$2]++;count++;} END { for (a in CMD )print CMD[ a ]" " CMD[ a ]/count*100 "% " a }' | grep -v "./" | column -c3 -s " " -t |sort -nr | nl | head -n10转载 2012-09-27 17:52:39 · 542 阅读 · 0 评论 -
test11
#!/bin/bash[ $# -eq 0 ]&&directorys=`pwd`|| directorys=$@#!/bin/basha=az[[ $a == a* ]]echo $? #此时返回的值,应该为0b=a* [[ $b == "a*" ]]echo $? #此时返回的值,也应该为0#区别如下:第一个$a匹配以a开头(模式匹配)那么结果为true第二个$b匹原创 2012-09-11 11:10:42 · 365 阅读 · 0 评论 -
test15
cat /etc/passwd |awk 'BEGIN{FS=":"}{print $1}'原创 2012-09-11 20:39:24 · 367 阅读 · 0 评论 -
spawn.sh
#!/bin/bash# spawn.shPIDS=$(pidof sh $0) # Process IDs of the various instances of this script.#打印出该脚本的pid进程P_array=( $PIDS ) # Put them in an array (why?). #引入变量echo $PIDS # Show process IDs of p原创 2012-09-19 20:11:29 · 687 阅读 · 0 评论 -
python 实现socket 连接一例
import socketimport sysfrom thread import *HOST = '' # Symbolic name meaning all available interfacesPORT = 8888 # Arbitrary non-privileged ports = socket.socket(socket.AF_INET, socket.SOCK_STR原创 2012-10-25 10:44:41 · 2192 阅读 · 0 评论 -
打印流量脚本
看到一个简单的打印 Linux服务器流量的脚本。#!/bin/bash alias ifconfig="/sbin/ifconfig" eth=eth0 while true; do RXpre=$(ifconfig ${eth} | grep bytes | awk '{print $2}'| awk -F":" '{print $2}') TXpre=$(ifconfig原创 2013-12-02 16:28:17 · 734 阅读 · 0 评论