现在位置 >首页 > Programme
11℃
2011年08月09日 Programme ⁄ 被围观 2,083+
功能简介: 用法: 用方向键移动蛇即可。 有个Bug:一开始蛇不会出现,按任意方向键蛇就可以出现了。 注意: 不能回头。比如蛇往右移动时,则这时不能按往左的方向键。 测试环境: [Bob]@[Fck_without_U]:[~]->uname -a    Linux bobtestmachine.net 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux    [Bob]@[Fck_without_U]:[~]->echo $0    -bash    [Bob]@[Fck_without_U]:[~]->echo $SHELL    /bin/bash    [Bob]@[Fck_without_U]:[~]->bash --version  ...
阅读全文

5℃
2011年07月05日 Programme ⁄ 被围观 2,779+
跨行匹配在sed里算不上是个难点,但绝对能考验一个人的sed基础…… 这里就以《sed & awk》一书中的例子(高级sed命令章节)作为对象,或者直接参看CU的这篇帖子:http://bbs.chinaunix.net/thread-1685452-1-1.html,具体分析一下代码思路和执行过程,我也是大菜鸟,有不对的地方,还望各位指出…… 首先明确一下几个概念: b label Branch to label; if label is omitted, branch to end of script. h H    Copy/append pattern space to hold space. g G    Copy/append hold space to pattern space. D      Del...
阅读全文
4℃
2011年06月16日 Tech ⁄ 被围观 2,046+
正文开始前,首先想先送给大家一幅图: CU链接:http://bbs.chinaunix.net/thread-2331821-1-1.html 发现最近回帖并不是那么的积极了,看看CU Shell版的前辈们,大牛们,出没的几率也小了很多…… 为什么? 分析了很多,如果多翻翻最近的帖子,其实不难总结出一个很重要的根源: 提问其实也是一种智慧,技术再牛的人,在一个表达不清,需求不明,含糊其辞的问题面前,一切都会显得苍白无力,到最后,大牛们都被征服了! 前两天和一些Shell版的前辈们聊天的时候一直在讨论这个问题,最后得出的结论是(比喻): 其...
阅读全文
8℃
2011年06月14日 Programme ⁄ 被围观 2,693+
date非常规用法总结
最近在CU上总是看到有人问date的一些用法,这里就针对一些非常规的或者说比较特殊的用法做个小结(当然,一些基本的用法就不做介绍了,不懂的请直接man吧),Feel free to give your comments... 以下讨论的内容主要涉及到3个方面: 1. 数字域的填充用法 2. 相对日期的获得 3. 时间戳和日期的互相转换 1. 数字域的填充: 默认情况下,在显示日期和时间时,date命令使用数字0填充数字域。例如,如果用两位数字显示月份,则6月显示为“06”,如下所示: $ date +%m 06 当然,一切皆有变通,你可以用下述控制符...
阅读全文
6℃
2011年06月02日 Programme ⁄ 被围观 2,286+
tr字符串处理:转换指定字符大小写
用英文用的太久了,这次就用中文了, 首先,此篇文章是由CU Shell版的一篇帖子引申出来的,有兴趣的可以点击一下链接查看: http://bbs.chinaunix.net/thread-2287787-1-2.html 其次,网中人前辈我就不介绍了,我想混过CU Shell版或者看过《13问》的人应该都很清楚,想了解更多,请点击网中人维护的站点:http://www.study-area.org/menu1.htm 本文很简单,只是一个小例子,但是还是需要说明几点: 第一,写程序或者写脚本,功底固然重要,但更重要的,是思想,这是我一贯所坚持的! 第二,关于tr的用法,这里...
阅读全文
5℃
2011年05月25日 Programme ⁄ 被围观 2,016+
Today I want share with you various ways(what I can call to mind are at least 10 ways) to combine two lines to one line...Those ways are used by awk, sed, xargs, paste, etc... Pls feel free to give your comments and welcome to point out if I missed something or I got something wrong...Thanks... Following is an original file named urfile(notes that there're blank spaces at the beginning of even lines): [12:37:20-Bob@hzling20:~/test]-(1083)No.83->$ cat urfile AA      ...
阅读全文
2℃
There're at least 4 ways to compare two strings by ignoring cases, and at least 5 ways to calculate the length of string, here I list those 4 and 5 ways, welcome feel free to comment your ideas. I: Case insensitive when comparing two strings: 1). If you're using bash, then following is a absolutely a good way, open the option "nocasematch": str1="MATCH" str2="match" shopt -s nocasematch case "$str1" in $str2) echo "match";;      *) echo "no match";; esac 2). Another good ...
阅读全文
1℃
2011年05月19日 Unix-Linux ⁄ 被围观 1,606+
---------------------- Reproduced statement: This post is reprinted/referred/quoted from the following link, good article: http://www.go2linux.org/rename-bulk-files-with-linux-console-command ------------------------------------------------------------------------- Important notes: All examples of this article are tested successfully in Ubuntu/Debian environment. And I have tested these examples also in RHEL/Non-Debian environment, but failed. So, pls note about this. --...
阅读全文

×
腾讯微博