Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

less or > doesn't always work

 
sonny kher
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when I try to pipe output from a build file to less or to a file, it doens't always catch everything. Why so?
ant > tempFile only writes like a couple of lines when the screen stdout sees like 50
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are actually two output streams (corresponding to System.out and System.err in Java). The '>' redirection only redirects the basic output stream, not the errors stream..
To redirect the error stream use 2>
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - One (among several) neat trick is:
some_command 2>&1 | tee logfile.txt
G.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic