while多用于死循环#!/bin/bash#每隔3秒,输出系统时间while::作为永恒帧dodate+%Tsleep3done#!/bin/bash#当n小于等于10时,n+1,并显示变量的值n=0不用:永恒帧时,先赋予可执行的条件。否则脚本不运行while[n-le10]doecho$nn=$[$n+1]done#!/bin/bash#用户输入一个数字,如果是..
分类:
其他好文 时间:
2015-07-27 16:33:49
阅读次数:
107
for循环 for loop in 1 2 3 4 5do echo "The value is: $loop" (双引号和无引号均可以,单引号不行,输出$loop)done运行结果:The value is: 1The value is: 2The value is: 3The value is:...
分类:
系统相关 时间:
2015-07-27 14:50:29
阅读次数:
170
CREATE PROCEDURE `test`.`new_procedure` ()BEGINDECLARE done INT DEFAULT FALSE; -- 需要定义接收游标数据的变量 DECLARE a CHAR(16); -- 游标 DECLARE cur CURSOR FOR ...
分类:
数据库 时间:
2015-07-26 20:35:25
阅读次数:
205
我们知道deferred.resolve()、deferred.reject()、deferred.notify()可以指定参数值,这个参数会传递给相应状态下的回调函数。如果我们使用的是done()、fail()、progress()注册的回调函数,那么某个状态下的所有回调函数得到的都是相同参数。但是如果我们使用了then()注册回调函数,那么第一回调函数的返回值将作为第二个回调函数的参数,同样的第二个函数的返回值是第三个回调函数的参数。...
分类:
Web程序 时间:
2015-07-26 19:21:21
阅读次数:
157
Machine Learning Done WrongStatistical modeling is a lot like engineering.In engineering, there are various ways to build a key-value storage, and eac...
分类:
系统相关 时间:
2015-07-26 15:28:52
阅读次数:
126
目录中有如下两个文件1.txt.filetouch2.txt.file想要实现删除.file,即扩展名,可通过以下脚本快速实现forfilein$(ls*.file);doext=${file%.*};mv$file$ext;done其中${file%.*}为获取文件名,mv$file$ext为重命名操作附加:echo${file##*.}可获取文件的扩展名echo${file%.*}可..
分类:
其他好文 时间:
2015-07-25 20:10:38
阅读次数:
335
(1)批量解析域名把域名保存在dns.txt文件,ping一次ping-c1打印第二行sed-n‘2p‘打印ip那个字段第4段awk‘{print$4}‘删除掉末尾的:号,删除最后一个字符,用sed替换为空sed‘s/.$//‘foriin`catdns.txt`;doping-c1$i|sed-n‘2p‘|awk‘{print$4}‘|sed‘s/.$//‘;done;
分类:
系统相关 时间:
2015-07-25 20:06:31
阅读次数:
129
论坛里的一个兄弟要同时折腾两个变量,不知道如何折腾.后来了解到可以用数组都忘记shell还有数组了.写了一个测试程序.记录一下.以后也有个印象.#!/bin/bash
declare-atmp
foriin$(find/bin-typef)
do
letc++
tmp[c]="$i"
done
len="${#tmp[@]}"#arraylength
c=200
foriin$(f..
分类:
编程语言 时间:
2015-07-25 07:14:37
阅读次数:
215
Each of the six faces on a cube has a different digit (0 to 9) written on it; the same is done to a second cube. By placing the two cubes side-by-side in different positions we can
form a variety of...
分类:
其他好文 时间:
2015-07-24 22:42:52
阅读次数:
231
当我越来越习惯python的编写风格时,我经常会想用bash去遍历一个文件的行,并将读取的行进行处理。
但一个诡异的情况,如果我的文本类似于这样
the first line.
the second line.
the third line.
for line in `cat filename`
do
echo $line
done
当我通过上面的方式遍历文件的每一行,我发现读...
分类:
系统相关 时间:
2015-07-22 18:48:38
阅读次数:
152