bash - Bourne Script: Redirect success messages but NOT error messages -


this command:

keytool -import -file "$serverpath/$servercer" -alias "$clienttrustedceralias" -keystore "$clientpath/$clientkeystore" -storepass "$serverpassword" -noprompt 

will when runs outputs: certificate added keystore

i tried redirecting stdard out with:

keytool ... > /dev/null 

but still printing.

it appears message being output standard error. since when not displayed:

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

however not wanting do. error messages output not want "success" messages output command line. ideas? whatever happened unix convention: "if works not output anything".

agreed, that's not friendly behaviour on part of keytool.

if set of success messages small, can use grep explicitly remove them, eg

keytool ... 2>&1 | grep -v '^certificate added keystore$' 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -