LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-09-2018, 07:34 AM   #1
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Rep: Reputation: 56
Openssl. How to suppress error message.


Hello

I want to suppress error message to the console when the password provided is wrong. Show content only when password is correct.

For ex, (password is 12345)

Code:
$ msg=$(echo "Hello World!" | openssl enc -aes-265-cdc -salt -a)

$ echo $msg
U2FsdGVkX19Gzenp7OyMIXOtvpAmetZrfPL4L8NAWd4=

# Correct password: 12345
$ echo $msg | openssl enc -aes-256-cbc -d -a
enter aes-256-cbc decryption password:
Hello World!

# Wrong password
$ echo $msg | openssl enc -aes-256-cbc -d -a
enter aes-256-cbc decryption password:
bad decrypt
140029904913984:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:../crypto/evp/evp_enc.c:536:
As you can see, if I input the wrong password there will be an error message (in bold). I want to suppress this error message. I'll base my next logic based on the exit status of that command but not on error message.

How to do that? I tried 2>/dev/null, but it doesn't work

Thanks
 
Old 09-09-2018, 07:45 AM   #2
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Original Poster
Rep: Reputation: 56
Sorry, it works . Ignore above post.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Shell Scripting: Suppress error / Best 3 out of 5 thealmightyos Linux - General 5 03-25-2015 10:53 AM
Suppress message from zip Fixit7 Puppy 3 05-12-2014 02:55 PM
suppress known warning message powah Programming 4 11-17-2007 08:34 PM
How to suppress particular warning message? hottdogg Programming 3 03-02-2007 01:15 AM
bash scripting - suppress error messages? brian0918 Programming 2 06-19-2003 11:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration