摘要: 在C语言中执行shell命令 1、system系统调用 int system(const char * string); system()会调用fork()产生子进程,由子进程来调用/bin/sh -c string来执行参数string字符串所代表的命令,此命令执行完后随即返回原调用的进程。在调用system()期间SIGCHLD 信号会被暂时搁置,SIGINT和SIGQ... 阅读全文
posted @ 2013-04-20 20:45 浪里飞 阅读(7954) 评论(0) 推荐(1) 编辑
摘要: 使expect脚本传回返回值 1、使用expect示例: spawn $SPAWN_CMD expect { -re "Enter password for new role:" { send "$PWPROMPT\n" exp_continue } -r... 阅读全文
posted @ 2013-04-20 17:26 浪里飞 阅读(3914) 评论(0) 推荐(1) 编辑
摘要: 统计当前目录下的所有文件目录大小,不显示子目录与子文件 du --max-depth=1 -a /home/talen |sort -n 用来查看我的主目录下的所有隐藏与非隐藏文件。 原文 http://blog.chinaunix.net/uid-21142030-id-3153714.html 阅读全文
posted @ 2013-04-20 15:43 浪里飞 阅读(375) 评论(0) 推荐(0) 编辑
摘要: json_decode - 对 JSON 格式的字符串进行编码 mixed json_decode( string $json) This function only works with UTF-8 encoded data. <?php $json = '{"foo-bar": 12345}'; $obj = json_decode($json); p... 阅读全文
posted @ 2013-04-20 15:41 浪里飞 阅读(157) 评论(0) 推荐(0) 编辑
摘要: PHP's json_encode() 函数 string json_encode ( mixed $value ) 返回 value 值的 JSON 形式;该函数只能接受 UTF-8 编码的数据(译注:指字符/字符串类型的数据) <?php $arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); echo json... 阅读全文
posted @ 2013-04-20 15:33 浪里飞 阅读(183) 评论(0) 推荐(0) 编辑
摘要: explode() 函数把字符串分割为数组。 explode(separator,string,limit) 原文 http://www.w3school.com.cn/php/func_string_explode.asp 阅读全文
posted @ 2013-04-20 15:21 浪里飞 阅读(159) 评论(0) 推荐(0) 编辑
摘要: fgets() 函数从文件指针中读取一行。 fgets(file,length) 原文 http://www.w3school.com.cn/php/func_filesystem_fgets.asp 阅读全文
posted @ 2013-04-20 15:17 浪里飞 阅读(180) 评论(0) 推荐(0) 编辑
摘要: fopen() 函数打开文件或者 URL。 如果打开失败,本函数返回 FALSE。 fopen(filename,mode,include_path,context) 原文 http://www.w3school.com.cn/php/func_filesystem_fopen.asp 阅读全文
posted @ 2013-04-20 15:14 浪里飞 阅读(196) 评论(1) 推荐(0) 编辑
摘要: trim() 函数从字符串的两端删除空白字符和其他预定义字符。 trim(string,charlist) 原文 http://www.w3school.com.cn/php/func_string_trim.asp 阅读全文
posted @ 2013-04-20 15:10 浪里飞 阅读(212) 评论(0) 推荐(0) 编辑