随笔分类 -  编写程序汇总

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

posted @ 2011-12-30 19:52 无心出岫 阅读(369) 评论(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)

脚本
摘要:#!/bin/sh directory() { for file in $( ls ./qq ) do cat ./qq/$file | while read line do sed -n '/'$line'/p' ./passwd >> ./jieguo/$file done # sort /home/guo/debug |uniq > /home/guo/debug.txt done } directory 阅读全文

posted @ 2011-11-04 18:42 无心出岫 阅读(144) 评论(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)