Chinaunix

标题: perl 的system 问题 [打印本页]

作者: niuniu_2118    时间: 2005-11-09 13:58
标题: perl 的system 问题
#!/usr/bin/perl
system("sed '$d' file1 | sed '$d' > file2 ");

原意是想删除文件2的最后两行,
可执行结果是file1和 file2一样.

为什么?
作者: 兰花仙子    时间: 2005-11-09 20:03
原帖由 niuniu_2118 于 2005-11-9 13:58 发表
#!/usr/bin/perl
system("sed '$d' file1 | sed '$d' > file2 ");

原意是想删除文件2的最后两行,
可执行结果是file1和 file2一样.

为什么?


这是sed的问题嘛,与perl没什么关系,到shell版问去吧。
作者: niuniu_2118    时间: 2005-11-10 09:45
可是单独在CSH下执行SED结果是正确的
作者: ifconfig    时间: 2005-11-10 13:51
提示: 作者被禁止或删除 内容自动屏蔽
作者: niuniu_2118    时间: 2005-11-10 14:22
谢谢!




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2