随笔分类 -  脚本

ATM
摘要:#!/bin/shHOSTNAME="localhost" #数据库信息PORT="3306"USERNAME="root"PASSWORD="guojunjie"#数据库名称DBNAME="bank" TABLENAME="user" #两个标记,用于判断是否超过输入flag=1flag1=1#输入帐号密码成功后进行接下来操作main(){echo "Please input what do yo... 阅读全文

posted @ 2011-12-30 20:12 无心出岫 阅读(218) 评论(0) 推荐(0)

用perl查找mysql数据库内容以及添加数据表等
摘要:关于perl处理my数据库的一些内容,看到书也不太了解,还好有文档。还是文档好。查看文档,在终端中输入:perldoc DBD::mysql1 #!/usr/bin/perl -w 2 use DBI; 3 my $database="datebasename"; 4 my $hostname="localhost"; 5 my $port="3306"; 6 my $user="username"; 7 my $password="password"; 8 $dsn = "DBI:m 阅读全文

posted @ 2011-12-21 10:21 无心出岫 阅读(1361) 评论(0) 推荐(0)

查看文件夹中的文件的修改时间,并从小到大排列出来到一个文件中
摘要:#!/bin/shecho -n "" >filefor dir in $( ls ) do time'=` date +%Y%m%d%H%M%S -r $dir ` echo "$time $dir" >>file done sort -n -k 1 file 阅读全文

posted @ 2011-11-19 19:56 无心出岫 阅读(401) 评论(0) 推荐(0)

sed替换
摘要:1、 [guo@localhost ~]$ cat ssss1234abb[guo@localhost ~]$ cat ssss |sed 's/[[:digit:]]//g'abbsed 's/[[:digit:]]//g' 提取数字和字符串组合后边的字符串 如12234ads执行输出ads2、[guo@localhost ~]$ cat ssss1234abb[guo@localhost ~]$ cat ssss | sed 's/[1-9]//g'abb 阅读全文

posted @ 2011-11-06 19:00 无心出岫 阅读(238) 评论(0) 推荐(0)

脚本2 (监控)
摘要:#!/bin/shecho -n "Please enter the number of person from the server :"read numn=`tail -n1 shuchu` if [ $n -eq $num ] ; then echo $num >> shuchu else echo $num >shuchu fim=`wc -l shuchu|awk '{print $1}'` if [ $m -ge 5 ] && [ $m -le 20 ] ; then if [ $n -eq 0 ] then e 阅读全文

posted @ 2011-11-06 13:00 无心出岫 阅读(235) 评论(0) 推荐(0)

查看该目录下有几个文件夹几个文件的shell代码
摘要:#!/bin/sh directory() { let "filenum = 0 " let "dirnum = 0 " ls $1 echo "" for dir in $( ls ) do if [ -d $dir ] then let "dirnum+=1" else let "filenum+=1" fi done echo "The number of directories is $dirnum " echo "The number of files i 阅读全文

posted @ 2011-10-08 17:47 无心出岫 阅读(324) 评论(0) 推荐(0)