Reputation: 15
how can i suppress warning message on ubuntu terminal, I am currently getting:
Warning: Using a password on the command line interface can be insecure. message.
I tried using:
2>/dev/null | grep -v "Using a password on the command line interface can be insecure"
but it suppresses all kinds of errors. Please help.
Upvotes: 0
Views: 2320
Reputation: 328
You are doing two things: 2>/dev/null
routes the standard error to /dev/null, and grep -v "Using a password on the command line interface can be insecure"
filters out any occurence of the string from the standard output.
Your warning message goes to the standard error, so it is being affected by the redirect (>
). The grep part is effectively being useless since it only affects the standard output.
You could try merging the standard error to the standard output, then filtering out this warning:
2>&1 | grep -v "Using a password on the command line interface can be insecure"
.
Please be aware that embedding passwords directly within commands is, indeed, insecure. One can recover it using your shell's history file. One day you might use a shared server, please remember this.
Upvotes: 2