12 2016 档案

摘要:Shell编程浅析 http://www.linuxidc.com/Linux/2014-08/105379.htm Linux Shell参数替换 http://www.linuxidc.com/Linux/2013-06/85356.htm Shell for参数 http://www.linu 阅读全文
posted @ 2016-12-05 14:46 feng_kui 阅读(5403) 评论(0) 推荐(0) 编辑
摘要:/* 类: 1、什么叫类:抽象出具有相同属性或者行为的对象。例:对象:张三,李四(类定义的一个变量,或者叫类声明的对象) 类(class,包含成员变量和成员方法):人,相同的属性(成员变量),身高,体重等。 2、什么叫抽象(抽取对象):提取相同的部分,去掉不同的地方。张三,李四:相同点:有身高,有体重。(有点像广... 阅读全文
posted @ 2016-12-02 11:20 feng_kui 阅读(1114) 评论(0) 推荐(0) 编辑
摘要:一、小括号,圆括号() 1、单小括号 () ①命令组。括号中的命令将会新开一个子shell顺序执行,所以括号中的变量不能够被脚本余下的部分使用。括号中多个命令之间用分号隔开,最后一个命令可以没有分号,各命令和括号之间不必有空格。 ②命令替换。等同于`cmd`,shell扫描一遍命令行,发现了$(cmd)结构,便将$(cmd)中的cmd执行一次,得到其标准输出,再将此输出放... 阅读全文
posted @ 2016-12-01 17:06 feng_kui 阅读(15204) 评论(0) 推荐(0) 编辑
摘要:#!/bin/sh #set -x i=1 while [ $i -le 100 ] do ret=1 j=2 while [ $j -lt $i ] do if [ $(($i%$j)) -eq 0 ];then ret=0 ... 阅读全文
posted @ 2016-12-01 16:21 feng_kui 阅读(198) 评论(0) 推荐(0) 编辑
摘要:方法2: #!/bin/sh #set -x file=/etc/passwd while read LINE #for i in `cat $file` do #username=`echo $i|cut -d: -f1` username=`echo $LINE|awk -F: '{print $1}'` userid=`echo $... 阅读全文
posted @ 2016-12-01 16:14 feng_kui 阅读(623) 评论(0) 推荐(0) 编辑
摘要:不算好的方法: #!/bin/sh echo "input num1:" read a echo "input num2:" read b echo "input operator:" read o case $o in +) awk 'BEGIN{printf "\t" "'$a'+'$b'=%.2f\n",'$a'+'$b'}' #... 阅读全文
posted @ 2016-12-01 16:12 feng_kui 阅读(1020) 评论(0) 推荐(0) 编辑
摘要:in.txt文件: 学号 姓名 性别 年龄 1001 张三 男 18 1002 赵四 男 19 1003 李丽 女 18 1004 刘芳 女 32 1005 王五 男 54 1006 小明 男 32 1007 麻子 男 12 1008 叮当... 阅读全文
posted @ 2016-12-01 16:02 feng_kui 阅读(369) 评论(0) 推荐(0) 编辑
摘要:1 求总分并且输出: 2 文件a.txt 3 学号 姓名 性别 年龄 4 1001 张三 男 18 5 1002 赵四 男 19 6 1003 李丽 女 18 7 文件b.txt 8 学号 语文 数学 英语 9 1001 80 70 98 10 1002 78 ... 阅读全文
posted @ 2016-12-01 15:52 feng_kui 阅读(185) 评论(0) 推荐(0) 编辑
摘要:ubuntu 中文乱码 如果使用的是 PuTTY,可以通过修改 font, character set 设置来解决。 Window -> Appearance -> Font settings 选择宋体或新宋体: Window -> Translation -> Character set translation on received data 选择 UTF-8: --ubuntu --设... 阅读全文
posted @ 2016-12-01 15:12 feng_kui 阅读(296) 评论(0) 推荐(0) 编辑