0

I am trying to assign the output of a command as a variable but I am getting unwanted output. How can I prevent this extra output?

# output=`yum check-update`
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
#

1 Answer 1

1

It might be quite difficult. That looks like an error message; it may simply be written to standard error, in which case, running this should suppress the error messages:

output=`yum check-update 2>/dev/null`

However, if the authors are determined that their message should get through, they may use /dev/tty instead of /dev/stderr for the output, in which case you have to detach your process from the terminal. Or they may be inventive and use another technique to blast the message to you.

On the whole, if the redirection of standard error doesn't suffice, the easiest thing may be to sign-up with RHN Classic or RHN Satellite. However, I'm not really aware of what that entails, so there could well be reasons not to do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.