Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am exec command:

yum info mcrypt | grep -i error > /dev/null
yum info mcrypt | grep -i error 2> /dev/null

But i see:

Error: No matching Packages to list

How I can hide this messasge from stdout?

share|improve this question

2 Answers 2

Its not exactly clear what you are trying to do - Why would you "grep" for an error message you don't want.

I suspect the problem you are having may be that you are diverting stderr after it has been displayed - you may want to be using

yum info mcrypt 2>/dev/null | grep -i "error"

Or, if you are simply wanting to ignore the error,

yum info mcryp3t 2>/dev/null
share|improve this answer
    
Thank you so mach. But it not what i want. i am using this expression to check avebility of yum package in my bash script. –  Java Dude Sep 16 '13 at 18:11
    
$(yum info mcrypt | grep -i error) 2> /dev/null the same –  Java Dude Sep 16 '13 at 18:12
1  
how about 'yum info mcrypt 2>&1 | grep "Name"' or 'yum info mcrypt 2>&1 | grep "Name" | wc -l' –  davidgo Sep 16 '13 at 18:16
up vote -4 down vote accepted

nohup commands > /dev/null 2>&1 &

share|improve this answer
    
Please explain how this solves your problem. –  Kwaio Nov 26 '13 at 8:40
1  
How is this related to the question? Yes you used 2>&1 as davidgo suggested two months ago. -- Combined in >/dev/null 2>&1 it will discard both stdout and stderr. ...but how is the nohup and background execution & related? –  pabouk Nov 26 '13 at 8:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.