原创 if usage
#! /usr/bin/python #* coding: utf-8 *age = int(input("input your age: ")) if age >= 50:print('old')elif age >= 25:print
原创 Dict & Set usage
#! /usr/bin/python #* coding:utf-8 *s1=set([4,4,5,5,6,6])print(s1)s2=set([2,3,4])print(s1&s2)print(s1|s2) #! /usr/bin/p
原创 Three methods about calculate string length
#! /bin/bash for i in I am oldboy linx welcome to our training ;do if [ echo ${#i} -ge 6 ];then echo $i fi done for i i
原创 operators usages
#! /bin/bash if [ $# -ne 2 ];thenecho "please input two arguments:"exit 2fiexpr $1 + 2 &>/dev/nullif [ $? -ne 0 ];thenec
原创 Case usage
#! /bin/bash read -p "please input a number:" acase "$a" in1)echo "The num is 1";;2)echo "The num is 2";;[3-9])echo "The
原创 Batch of create users
#! /bin/bash for i in seq -w 11 20;doid user$i &> /dev/nullretal=$? if [ $retal -ne 0 ];then useradd user$i &>/dev/null
原创 Batch of create users
#! /bin/bash for i in seq -w 11 20;doid user$i &> /dev/nullretal=$? if [ $retal -ne 0 ];then useradd user$i &>/dev/null
原创 Statistics access traffic of apache logs
#! /bin/bash sum=0exec <$1while read line ;dosize=echo $line | awk '{print $10}'expr $size + 1 &>/dev/nullif [ $? -ne 0
原创 Color usage
#! /bin/bash red_color='\E[1;31m'gree_color='\E[1;32m'yello_color='\E[1;33m'blue_color='\E[1;34m'end='\E[0m'echo -e "$re
原创 Guess the number
#! /bin/bash total=0num=$((RANDOM%41))pear(){read -p "please input number:" aexpr $a + 1 &> /dev/nullif [ $? -ne 0 ];the
原创 batch configure ip address
RETVAL=0oper(){if [ "$1" == "del" ];then list=echo{10..1}elselist=echo{1..10}fi for ip in $list;do if [ $ip -eq 5 ];the
原创 mysql start scripts
#! /bin/bash mysqluser=rootmysqlpass=123.commysqlpath=/usr/mysql/binmysqlprot=3306 start(){if [ netstat -tnlup | grep '$
原创 Check website online
#! /bin/bash . /etc/init.d/functionsurl_list=(http://www.baidu.comhttp://www.123.comhttp://www.sohu.com) wait(){echo -n
原创 ping test online pc
#! /bin/bashdeclare -i sum1=0declare -i sum2=0for i in seq 30;do{ ping -c 1 -t 1 10.60.1.$i &> /dev/nullretal=$?if
原创 rsync chkconfig scripts
if [ $# -ne 1 ];then#! /bin/bash #chkconfig 2345 30 60 #This scripts is sync if [ $# -ne 1 ];thenecho $"usage:$0 {start