摘要: 在远程操控Linux时,有很多强大的shell命令可以帮助我们。其中复制文件和文件夹就是一个非常强大的功能。 1、同一台机器上的复制命令 cp。 复制文件 cp filename1 filename2 ,把filename1复制一份并命名为 filename2 。 加上参数 -f 在覆盖重命名文件时不做任何提示。 如: cp -f filename1 filename2。 上述命令加上参数-r 就可以复制文件夹了。如 cp -rf dic1,dic2。关于cp更详细的命令如下: 语法:cp [-abdfilpPrRsuvx][-S <备份字尾字符串>][-V <备份方式> 阅读全文
posted @ 2012-04-17 13:49 agile_work 阅读(478) 评论(0) 推荐(0) 编辑
摘要: 获取当前时间距纪元时间(1970年1月1日)所经过的天数: 在获取两个时间之间的差值时,需要考虑很多问题,如闰年、月份中不同的天数等。然而如果我们能够确定两个时间点之间天数的差值,那么再计算时分秒的差值时就非常简单了。在系统提供的C语言函数中,获取的时间值是从1970年1月1日0点到当前时间所流经的秒数,如果我们基于此计算两个时间之间天数的差值,将会大大简化我们的计算公式。 /> cat > test6.sh #!/bin/sh #1. 将date命令的执行结果(秒 分 小时 日 月 年)赋值给数组变量DATE。 declare -a DATE... 阅读全文
posted @ 2012-04-17 10:47 agile_work 阅读(1289) 评论(0) 推荐(0) 编辑
摘要: 1. find find pathname -options [-print -exec -ok] 让我们来看看该命令的参数: pathname find命令所查找的目录路径。例如用.来表示当前目录,用/来表示系统根目录。 -print find命令将匹配的文件输出到标准输出。 -exec find命令对匹配的文件执行该参数所给出的shell命令。相应命令的形式为'command' {} \;,注意{}和\;之间的空格,同时两个{}之间没有空格, 注意一定有分号结尾。 0) -ok 和-exec的作用相同,... 阅读全文
posted @ 2012-04-17 10:33 agile_work 阅读(392) 评论(0) 推荐(0) 编辑
摘要: 1、数据文件格式如下: 0 1 2 3 4 5 6 ch1 0 1 4 3 4 5 6 ch3 0 1 2 3 4 5 6 ch2 0 1 3 3 4 5 6 ch1 0 1 ... 阅读全文
posted @ 2012-04-17 10:20 agile_work 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.cnblogs.com/chengmo/archive/2010/09/30/1839632.html1.数组定义 [chengmo@centos5 ~]$ a=(1 2 3 4 5)[chengmo@centos5 ~]$ echo $a1 一对括号表示是数组,数组元素用“空格”符号分割开。 2.数组读取与赋值得到长度:[chengmo@centos5 ~]$ echo ${#a[@]}5用${#数组名[@或*]} 可以得到数组长度读取:[chengmo@centos5 ~]$ echo ${a[2]} 3[chengmo@centos5 ~]$ echo ${a 阅读全文
posted @ 2012-04-17 10:04 agile_work 阅读(3639) 评论(0) 推荐(0) 编辑
摘要: cut命令是用来剪下文本文件里的数据,文本文件可以是字段类型或是字符类型。下面给出应用实例: /> cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin ... ... /> cut -d : -f 1,5 /etc/passwd #-d后面的冒号表示字段之间的分隔符,-f表示取分割后的... 阅读全文
posted @ 2012-04-17 09:56 agile_work 阅读(14083) 评论(0) 推荐(0) 编辑
摘要: 1. 显示系统中全部Android平台: android list targets2. 显示系统中全部AVD(模拟器): android list avd3. 创建AVD(模拟器): android create avd --name 名称 --target 平台编号4. 启动模拟器: emulator -avd 名称 -sdcard ~/名称.img (-skin 1280x800)5. 删除AVD(模拟器): android delete avd --name 名称6. 创建SDCard: mksdcard 1024M ~/名称.img7. AVD(模拟... 阅读全文
posted @ 2012-04-17 09:48 agile_work 阅读(273) 评论(0) 推荐(0) 编辑