if 语句通过关系运算符判断表达式的真假来决定执行哪个分支。Shell 有三种 if ... else 语句:if ... fi 语句;if ... else ... fi 语句;if ... elif ... else ... fi 语句。1) if ... else 语句if ... else ...
分类:
系统相关 时间:
2014-10-14 02:26:07
阅读次数:
339
case ... esac 与其他语言中的 switch ... case 语句类似,是一种多分枝选择结构。case 语句匹配一个值或一个模式,如果匹配成功,执行相匹配的命令。case语句格式如下:case 值 in模式1) command1 command2 command3 ...
分类:
系统相关 时间:
2014-10-14 01:51:17
阅读次数:
313
#include
int main(void)
{
int j, i = 3;
printf("j = %d\n", j = (++i) + (++i) + (++i));
i = 3;
printf("j = %d\n", j = (i++) + (i++) + (i++));
i = 3;
printf("j = %d\n", j = (...
分类:
其他好文 时间:
2014-10-14 00:57:37
阅读次数:
208
什么是memcache?Memcache是一个高性能的分布式的内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表,它能够用来存储各种格式的数据,包括图像、视频、文件以及数据库检索的结果等。简单的说就是将数据调用到内存中,然后从内存中读取,从而大大提高读取速度(摘自360百科)它相当于一个内...
分类:
系统相关 时间:
2014-10-13 22:59:27
阅读次数:
215
一、Crontab -e 加入输出Log*/1 * * * * /qiwen_list/upload_to_hdfs.sh > /qiwen_list/mapred.log 2>&1二、查看Log发现,找不到Hadoop三、脚本中指定Hadoop完整路径#!/bin/sh#upload list t...
分类:
Web程序 时间:
2014-10-13 22:51:47
阅读次数:
659
思路:在unix系统中有一个名为utmp的文件,里面存着当前登录到系统中用户的信息。utmp这个文件里面保存的是结构数组,数组元素是utmp类型的结构。实现who命令,只要依次从utmp文件中读出utmp类型的结构体,然后通过合适的方式将它显示出来即可。如果每一次只从文件里面读一个结构体数据,那么每一个结构体都要进行依次系统调用。而又因为系统调用比较耗时(涉及到用户态到核心态的切换),所以这样会造...
分类:
系统相关 时间:
2014-10-13 22:48:47
阅读次数:
265
1、#include#include#include#includeusing namespace std;int main() { int a,b,c; a = rand() % 1000; b = rand() % 1000; c = rand() % 4; if (c==0) { printf...
分类:
其他好文 时间:
2014-10-13 22:06:57
阅读次数:
161
python<tab>自动补全一。这个方法可以修改shell命令行的自动补全1.获取python目录【我使用的是64位ubuntu系统】[~$]pythonPython2.7.3(default,Apr102013,06:20:15)[GCC4.6.3]onlinux2Type"help","copyright","credits"or"license"formoreinformation.>>>import..
分类:
编程语言 时间:
2014-10-13 21:43:07
阅读次数:
235
python检测linux下运行的进程#-*-coding:utf8-*-
importsubprocess
importsys
status_ok=0
status_critical=2
defc(d_name):
cmd=‘ps-ef|grep%s|grep-v"grep"‘%d_name
p=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
ifp.wait()==0:
val=p.stdout.read()
ifd_name..
分类:
编程语言 时间:
2014-10-13 21:12:07
阅读次数:
244
第一章1、代码如下#include #include #include using namespace std;int main(){ srand(time(0)); while(1){ printf("随机生成的一个小学四则运算题目,除法省去余数\n"); int num1 = rand() % ...
分类:
其他好文 时间:
2014-10-13 19:50:27
阅读次数:
421