由买买提看人间百态

topics

全部话题 - 话题: somefile
(共0页)
w*****n
发帖数: 94
1
来自主题: Unix版 - UNIX Tip: the bad and the good
THE BAD AND THE GOOD
I cringe anytime I see someone code inefficiently. Here are
three of the most common mistakes, followed by a better way to
do the same thing.
Bad: cat somefile | grep something
Better: grep something somefile
Why: You're running one program (grep) instead of two (cat
and grep).
Bad: ps -ef | grep something | grep -v grep
Better: ps -ef | grep [s]omething
Why: You抮e running two commands (grep) instead of three (ps
and two greps).
Bad: cat /dev/null > somefile
C********g
发帖数: 1548
2
来自主题: Linux版 - SED命令求解
sed -i '/AllowOverride None/c AllowOverride All' somefile
ubuntu/debian
这个起到什么作用?
c**t
发帖数: 2744
3
来自主题: Programming版 - 关于STDERR定向到文件问题
我想在某个routine中将STDERR定向到文件,routine结束后,取消定向。
sub func
{
open(ERROR, "> somefile");
STDERR->fdopen(\*ERROR, "w);
...
close(ERROR);
}
问题是此后STDERR都消失了,怎么让它重新回到STDERR?
(共0页)