Weblog entry #2 for ashirvani

Redirecting stderr and stdout to less
Posted by ashirvani on Mon 24 Dec 2007 at 17:17
Tags: none.
To redirect stderr and stdout to less do:

<your command> 2>&1 | less

I did not any way to only redirect stderr to less? If you know how can
do that please help me.

Thanks.

 

Comments on this Entry

Posted by philcore (70.106.xx.xx) on Mon 24 Dec 2007 at 17:40
[ Send Message | View Weblogs ]
<yourcommand> 2>&1 1>/dev/null | less

should do what you want.


phil

[ Parent | Reply to this comment ]

Posted by i5513 (213.227.xx.xx) on Fri 28 Dec 2007 at 17:26
[ Send Message | View Weblogs ]
Use '>' better than '1>', isn't it?:
<yourcommand> 2>&1 >/dev/null | less

[ Parent | Reply to this comment ]

Posted by philcore (70.106.xx.xx) on Fri 28 Dec 2007 at 19:09
[ Send Message | View Weblogs ]
Hmm. Define "better"?

I would think ours are the same except I explicitly define which output is going to dev/null. Am I wrong?


phil

[ Parent | Reply to this comment ]

Posted by i5513 (213.227.xx.xx) on Fri 28 Dec 2007 at 19:23
[ Send Message | View Weblogs ]
On manuals and how to, I always see:
echo XXX > YYY

It's shorter than '1>'

But, yes it's is the same exactly the same.

It was a tip (I said better because my english is very bad ;) )

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search