Bourne Script: Redirect success messages but NOT error messages

Posted by sixtyfootersdude on Stack Overflow See other posts from Stack Overflow or by sixtyfootersdude
Published on 2010-04-27T18:02:01Z Indexed on 2010/04/27 19:13 UTC
Read the original article Hit count: 522

Filed under:
|
|
|
|

This command:

keytool -import -file "$serverPath/$serverCer" -alias "$clientTrustedCerAlias" -keystore "$clientPath/$clientKeystore" -storepass "$serverPassword" -noprompt

Will when it runs successfully outputs: Certificate was added to keystore

I tried redirecting the stdard out with:

keytool ... > /dev/null

But it is still printing.

It appears that the message is being output into standard error. Since when I do this it is not displayed:

keytool ... > /dev/null 2>&1

However this is not what I am wanting to do. I would like error messages to be output normally but I do not want "success" messages to be output to the command line. Any ideas? Whatever happened to unix convention: "If it works do not output anything".

© Stack Overflow or respective owner

Related posts about bourne

Related posts about shellscript