A easy example to tell you what is "2>&1" in Perl
2015-01-22 17:09
316 查看
You can decide if make the output shown on command screen by using 2>&1 or NUL
Testing script:
print "without null \n";
system("dir 2>&1");
print "with null \n";
system("dir > NUL");
print "end \n";
Result:
C:\Rebecca\script\perl\Unicode>perl calculate.pl
without null
Volume in drive C isOSDisk
Volume Serial Numberis BA23-5612
Directory of C:\Rebecca\script\perl\Unicode
01/22/2015 04:59PM <DIR> .
01/22/2015 04:59PM <DIR> ..
01/22/2015 04:58PM 227 calculate.pl
01/22/2015 09:19AM 194 unicode_test_v1.pl
01/21/2015 05:23PM 193unicode_test_v1.pl.ba
3File(s) 614 bytes
2Dir(s) 175,476,535,296 bytes free
with null #you can see with NUL, there isn't any output shown here
end
Testing script:
print "without null \n";
system("dir 2>&1");
print "with null \n";
system("dir > NUL");
print "end \n";
Result:
C:\Rebecca\script\perl\Unicode>perl calculate.pl
without null
Volume in drive C isOSDisk
Volume Serial Numberis BA23-5612
Directory of C:\Rebecca\script\perl\Unicode
01/22/2015 04:59PM <DIR> .
01/22/2015 04:59PM <DIR> ..
01/22/2015 04:58PM 227 calculate.pl
01/22/2015 09:19AM 194 unicode_test_v1.pl
01/21/2015 05:23PM 193unicode_test_v1.pl.ba
3File(s) 614 bytes
2Dir(s) 175,476,535,296 bytes free
with null #you can see with NUL, there isn't any output shown here
end
相关文章推荐
- 错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
- Error message when you try to save a table in SQL Server 2008: "Saving changes is not permitted"
- Q:Is there any way to define what the "Open Resource" dialog in Eclipse should show?
- What does '>/dev/null 2>&1' mean in this article of crontab basics
- "The file you are trying to open, '[filename]', is in a different format" Excel Error
- linux shell 中"2>&1"含义
- The best way to be "right once" is to have the ability to envision what things are going to look like three weeks, three months
- linux shell 中"2>&1"含义
- javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>
- linux shell 中"2>&1"含义
- linux shell 中"2>&1"含义
- linux shell 中"2>&1"含义
- Using Timer to get history values from EDNA database, an error is prompted in the page : "Sys.WebForms.PageRequestManagerTimeout
- hadoop "File /user/<user>/input/conf/slaves could only be replicated to 0 nodes, instead of 1"问题及解决办
- [原创]What is "Type" in managed heap?
- linux shell 中 "2>&1" 含义
- linux shell 中"2>&1"含义
- linux shell 中"2>&1"含义
- Server Error in '/' Application. Access to the Path Is Denied" error message appears
- linux shell 中"2>&1"含义