问题1:
用最简洁的命令列出当前目录下的一级子目录,可以不包含隐藏目录(目录名以.开头的目录)
问题2:
GNU sed 提供了-i选项,为什么有人说sed -i 并不象 ed 一样真正的编辑文件?(提示:观察文件改变前后的inode)
问题3:
用shell写一个cgi脚本,提供一个简单的webmail介面,将本地的一个文件通过web服务器发送到指定的邮箱
问题4:
awk -F'' 与 awk -F '' 一样吗?
问题5:
这条语句有什么作用?
sed -if /script/scr.sedcc test.txt
问题6:
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
是如何执行的?与"#!/usr/local/bin/tclsh"相比,它有什么优点?
问题7:
#!/bin/sed -f" shebang 后可有其它字符吗?为什么?
问题8:
GNU awk的$1=$1到底有什么作用?$0=$0呢?
问题9:
写一个shell脚本,输出CU现有的版面和相应版主,并统计有多少个版面及多少个版主。
问题10:
人机五子棋。原始规则(无禁手),最好加上标准规则,三手交换(即黑下第二手之后白可以提出交换),五手两打,黑三三禁手,黑四四禁手,黑长连禁手(超过5个子相连),逢五无禁手。白无禁手,长连也算胜。关键在于人机对下。
Null strings are removed when they occur as part of a non-null command-line argument, while explicit non-null objects are kept. For example, to specify that the field separator FS should be set to the null string, use:
awk -F "" 'program' files # correct
Don't use this:
awk -F"" 'program' files # wrong!
In the second case, awk will attempt to use the text of the program as the value of FS, and the first file name as the text of the program! This results in syntax errors at best, and confusing behavior at worst.
回复 xiaopan3322
弱弱的问下 (echo "contents"; uuencode urfile file)
你这句什么意思?? ...
db2-zhang 发表于 2011-05-16 14:52
[quote]http://www.itiyu.com/project/chess/331/rule.htm
sh-3.00# v='1 2 3:a:b:c'
sh-3.00# echo $v|awk '{FS=":";print $1,NF}'
1 3
sh-3.00# echo $v|awk '{FS=":";$0=$0;print $1,NF}'
1 2 3 4
sh-3.00# echo $v|awk '{OFS=":";print $0,NF}'
1 2 3:a:b:c:3
sh-3.00# echo $v|awk '{OFS=":";$1=$1;print $0,NF}'
1:2:3:a:b:c:3
最后一题如果用shell的话肯定慢得很,大家可以看附件里的规则,或这里
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |